Introduction to Grafyte
Grafyte is a 2D engine for Python. The public API is small: you create an Application, build one or more Scene instances, switch the active scene when needed, spawn Object or TextObject entities, and drive them from the main loop. Grafyte also includes a UI layer for screen-space text overlays.
Basic Imports
Every program starts with the package import:
import grafyte
It is also common to import the enums you use for input and collision logic:
import grafyte
from grafyte import Direction, InputTrigger, Key
Core Concepts
Applicationowns the window, timing, rendering, and input state.Scenestores world objects and exposes acamera.Applicationcan create and activate multiple scenes.Objectrepresents a renderable rectangle in the scene.TextObjectrenders text inside a scene.UIManagerrenders screen-space text overlays and lives alongside the active scene.InputManagerprovides raw key states and action-based input.
Most of the tutorial examples follow the same structure:
Create an
Application.Create a
Scene.Spawn objects.
Update them inside
while not app.should_close():.Call
app.render()every frame.