Skip to main content

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")

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

Many keys are 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.

Simple tkinter window with key event binding:

  • set_resize(width: bool, height: bool): Sets if the window's width and height can be resized.
  • show(): Opens the window and starts listening for key presses.
  • after(ms: int, func: FunctionType): Runs a function after a specified amount if milliseconds.
  • 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, abc, and inspect.


📄 License

InGame is licensed under the 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 by Natuworkguy

Metadata

Release files for ingame 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ingame 0.4.4
File Size Uploaded
ingame-0.4.4.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ingame 0.4.4
File Interpreter ABI Platform
ingame-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / ingame-0.4.4.tar.gz

Download URL ingame-0.4.4.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
372c4dd7e50c829c2ee6683e17009e7c521db66947650466db815a8ceea6eeb4
BLAKE2b-256 checksum
How to use checksums
da2a1d7074b658df70a06c08fe9ffabbb55e368fc57ef31711598f82165f0173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / ingame-0.4.4-py3-none-any.whl

Download URL ingame-0.4.4-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65e4ce39f335cae5791964c2af5ecc1503202bd8c7f1591433ca7c4691874646
BLAKE2b-256 checksum
How to use checksums
ef24ad517c5a9da9559b293089f24c95db5d3273293df6a69c53ca154011fa03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page