Metadata-Version: 2.1
Name: tkpygame
Version: 0.1.0
Summary: A custom Tkinter-Pygame module.
Home-page: https://github.com/lexxnl/tkpygame
Author: Lex Kimmel
Author-email: lex.kimmel@gmail.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygame
Requires-Dist: Pillow

# tkpygame

`tkpygame` is a Python package that combines Tkinter and Pygame functionality to enable enhanced GUI components and graphics rendering within Python applications. The package provides pre-built components, utilities, and color formatting options to facilitate a streamlined development experience.

## Features

- **Custom GUI Components**: Easily use components like buttons, dropdowns, input fields, and more with additional customization.
- **Base64 Icon Handling**: Set application icons from base64-encoded images.
- **Pygame Integration**: Allows for creating, rendering, and managing Pygame components within a Tkinter environment.
- **Utilities**: Provides utilities for layout management, color formatting, and canvas updates.

## Installation

You can install `tkpygame` via pip:

```bash
pip install tkpygame
```

Make sure you have Python 3.6 or later.

## Dependencies

`tkpygame` requires the following external libraries, which are installed automatically with `pip`:

- `pygame`: Used for graphics rendering.
- `Pillow`: Used for handling images, especially for loading and converting images in base64 format.

## Usage

Here's a quick example to get you started. This assumes you have installed `tkpygame` and want to use components from the `jiggleifymodules` package.

### Example

```python
from jiggleifymodules import Canvas, Button, Dropdown, InputField
import pygame

# Initialize pygame and Tkinter
pygame.init()

# Create and customize a Tkinter canvas with Pygame integration
canvas = Canvas(width=400, height=300)
button = Button(text="Click Me")
dropdown = Dropdown(options=["Option 1", "Option 2"])
input_field = InputField(placeholder="Type here...")

# Example function to set an icon from a base64 string
base64_icon = "iVBORw0KGgoAAAANSUhEUgAAAAUA..."  # Example base64 string
set_icon_from_base64(base64_icon)
```

### Components Overview

- **Canvas**: A Tkinter canvas with added methods for positioning and rendering Pygame visuals.
- **Button**: A customizable button component with text and styling options.
- **Dropdown**: A dropdown selection component.
- **InputField**: A text input field with a placeholder.
- **Label**: A label component with color and font styling.
- **Listbox** and **ListboxItem**: Components for displaying lists of items.
- **Popup**: A modal popup component for displaying messages or custom content.
- **ImageButton**: A button component that uses an image as its icon.

### Utility Functions

- `set_icon_from_base64(base64_string)`: Sets the application icon using a base64-encoded image string.
- `print_colored(text, color)`: Prints text to the terminal with ANSI color codes.

### Layout Utilities

- `update_canvas_rect(canvas)`: Updates canvas dimensions based on dynamic size attributes.
- `update_rect(obj)`: Updates an objectâ€™s dimensions and position based on its parent canvas properties.

## Terminal Colors

The package provides the `TerminalColors` class with predefined color codes to enable colorful terminal output. Hereâ€™s an example:

```python
from jiggleifymodules import TerminalColors, print_colored

print_colored("This is a warning message", TerminalColors.WARNING)
print_colored("This is an error message", TerminalColors.FAIL)
```

## Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository, make your changes, and submit a pull request.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

This `README.md` provides an overview, installation instructions, usage examples, and detailed descriptions of your package's components and functions. Adjust the details based on your specific module functionality and include any additional examples as necessary.
