Skip to main content

A simple framework for creating robust 2D GUI applications using Pygame and ImGui.

Project description

Pimgu

Pimgu is a lightweight framework that combines the power of Pygame and ImGui to create intuitive and responsive 2D GUI applications. This framework provides an easy-to-use interface to build user interfaces while harnessing the capabilities of Pygame and ImGui under the hood.

Features

  • Simple API for creating and managing ImGui-based user interfaces
  • Integrated with Pygame for efficient event handling and rendering
  • Customizable callbacks for input handling, ImGui rendering, and Pygame rendering
  • Easy control of application flow and frame rate
  • Cross-platform support

Installation

It is recommended that you have <= Python 3.6 installed on your machine.

pip install pimgu

Usage

Here's a basic example of how to create a Pimgu application with a simple ImGui window:

import imgui
from pimgu import Applet

def main_gui():
    imgui.begin("My First Pimgu Window")
    imgui.text("Hello, world!")
    imgui.end()

if __name__ == "__main__":
    app = Applet(title="Pimgu Example")
    app.register_imgui_callback(main_gui)
    app.run()

Documentation

Applet

The core class of Pimgu is Applet, which provides a high-level interface to manage your application.

Applet Constructor

Create a new Applet instance with the following parameters:

  • title (str, optional): The title of the application window. Default is "Pimgu Application".
  • dimensions (tuple, optional): The dimensions of the window (width, height). Default is (1280, 720).
  • icon_path (str, optional): Path to the window icon (optional). Default is an empty string.

Applet Methods

  • run(): Runs the main loop of the application.
  • register_input_callback(callback: Callable): Register a callback to be called during Applet input processing.
  • register_imgui_callback(callback: Callable): Register a callback to be called during Applet GUI processing.
  • register_pygame_render_callback(callback: Callable[..., Tuple[pygame.Surface, int, int]]): Register a callback to be called during Pygame render time.
  • register_tick_callback(callback: Callable): Register a callback to be called during the Applet's tick stage (before rendering, after input).

Applet Properties

  • get_title() -> str: Get the title of the application window.
  • get_screen() -> pygame.Surface: Get the Pygame screen surface.
  • get_imgui_io(): Get the ImGui IO buffer.
  • get_imgui_renderer() -> PygameRenderer: Get the ImGui Pygame renderer.
  • get_clock() -> pygame.time.Clock: Get the Pygame clock object.
  • get_cls_color() -> tuple: Get the clear color of the OpenGL buffer.
  • is_running() -> bool: Check if the application is running.
  • get_target_fps() -> int: Get the target frame rate.
  • set_cls_color(cls_color: tuple): Set the clear color of the OpenGL buffer.
  • set_running(running: bool): Set the application running state.
  • set_target_fps(target_fps: int): Set the target frame rate.

Examples

You can find more examples in the examples folder, which demonstrate various features of Pimgu, such as handling input events, custom rendering, and ImGui usage.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests to help improve Pimgu.

License

Pimgu is released under the MIT License. See the LICENSE file for more information.

Contact

This project is developed and maintained by Ian Wilkey (iwilkey). Feel free to contact him through his website, https://www.iwilkey.com/contact, with any questions, concerns, ideas, or issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pimgu-5.4.2023.7.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

pimgu-5.4.2023.7-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pimgu-5.4.2023.7.tar.gz.

File metadata

  • Download URL: pimgu-5.4.2023.7.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pimgu-5.4.2023.7.tar.gz
Algorithm Hash digest
SHA256 1a1f5d42a2b4dbe43784eb77e0a7ded1b1a6af3dcc0ea1ac98b9e882513acf81
MD5 7637824397b0eee086d3be589d115cab
BLAKE2b-256 b8c21365964b08fd90c0271277a6ac3b955e0e20f7965c77aa31b883921d1af8

See more details on using hashes here.

File details

Details for the file pimgu-5.4.2023.7-py3-none-any.whl.

File metadata

  • Download URL: pimgu-5.4.2023.7-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for pimgu-5.4.2023.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2e238371ce6c038586b4542024d749add8db7a4e0ee8289462693c89359075af
MD5 99477f4b43cccb0d52723752755d3e47
BLAKE2b-256 3e618cfd292c9b294665f9edc153b35e6b90936ee632d43db5d43a8de8eb0eda

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page