Skip to main content

A window and UI library based on tkinter.

Project description

InGame 🎮

InGame is a lightweight Python library designed to simplify making amazing UIs within a basic GUI window using tkinter. It enables developers to easily register and trigger events based on key presses with clean, decorator-based syntax.


✨ Features

  • ✅ Decorator-based event binding
  • ✅ Enum-based key recognition (A–Z, arrows, Enter, Escape, etc.)
  • ✅ Clean and extensible architecture
  • ✅ Simple GUI rendering using tkinter

🚀 Getting Started

🔧 Installation

Use pip install ingame to install the project.


🧠 Usage Example

from ingame.core import InGame, Screen, EventType
from ingame.objects import Text, Button, Input

app = InGame()

@app.event(type=EventType.Key.A)
def handle_a():
    print("Key A pressed!")

@app.event(type=EventType.Key.ESCAPE)
def handle_escape():
    print("Escape pressed!")
    screen.quit()

screen = Screen(app, title="My InGame App", width=600, height=400)

screen.set_resize(True, True)

hello_text = Text(screen, text="Hello!")
Button(screen, text="Click me", command=hello_text.destroy)

ht_input = Input(screen, packargs={"pady": 10})

def ht_click() -> None:
    print(ht_input.get())

Button(screen, text="Print input value", command=ht_click, packargs={"pady": 10})



screen.show()

🎮 Supported Keys

Supported via EventType.Key, including:

  • A–Z
  • Arrow keys: UP, DOWN, LEFT, RIGHT
  • ENTER, ESCAPE, BACKSPACE

📦 Components

InGame

Handles registering and triggering events:

  • @event(type: EventType.Key): Registers a function for a specific key event.
  • trigger_event(type): Manually triggers an event.

Screen

Simple tkinter window with key event binding:

  • show(): Opens the window and starts listening for key presses.
  • quit(): Closes the window.

⚠️ Exceptions

  • InGameException: Raised for invalid usage such as missing event type or unregistered keys.

🛠️ Development Notes

Written in Python 3.10+ Uses tkinter, Enum, and inspect.


📄 License

MIT License


❤️ Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you’d like to change.


👤 Author

Made with ❤️ by Natuworkguy

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

ingame-0.3.8.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ingame-0.3.8-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file ingame-0.3.8.tar.gz.

File metadata

  • Download URL: ingame-0.3.8.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ingame-0.3.8.tar.gz
Algorithm Hash digest
SHA256 e56f4b113eb337bd46b32521e30778c1928fc16e94e1e3fc840e51ed9975e39e
MD5 1d0abab267145ea84b89478071943d9a
BLAKE2b-256 ea8d4dcc5e4b7696a15d08392981912802671bd9284aa75aac616d2fda0b341c

See more details on using hashes here.

File details

Details for the file ingame-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: ingame-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ingame-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c43af8c47e9fe401da6cfdf89b0f29af602ff00627872c34015aee250d72ca
MD5 9d9e241ec64c0e1b6c00389ed16770cf
BLAKE2b-256 23b999dabe092a53c4a3ccaf91437c55ee410ca628ba69483cde0191a462321a

See more details on using hashes here.

Supported by

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