Skip to main content

A window and UI library based on tkinter

Project description

InGame 🎮

InGame is a lightweight Python library designed to simplify UI making 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

No installation required! Just drop ingame.py into your project.


🧠 Usage Example

from ingame import InGame, Screen, EventType

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.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 (Add your own license here if different)


❤️ 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.1.1.tar.gz (4.1 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.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ingame-0.1.1.tar.gz
Algorithm Hash digest
SHA256 69373a74e783a76d72b43838f5c042db73f8079424eb62fa0e9656f54a3ce110
MD5 a66ac6def160d8e1924ae3c0fce9f645
BLAKE2b-256 2701cd8ab0023cebc134393616d6c0209a17917161e23690c5a86168ed9c17c8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ingame-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60a587471bac064cd210757e6c7dca6cd4ca8a9ea9e2af8addb16bfe95af61fe
MD5 9822ebc6006228a713fdf7c66c0bcfef
BLAKE2b-256 95a926e49a7475b590b6ff9445f88c25457a2f28b496bc55fe951292b18bb420

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