Skip to content

Instantly share code, notes, and snippets.

@llimllib
Created July 23, 2020 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llimllib/9583771ead2fc100b3c0a01de87dfe58 to your computer and use it in GitHub Desktop.
Save llimllib/9583771ead2fc100b3c0a01de87dfe58 to your computer and use it in GitHub Desktop.
import pyglet
window = pyglet.window.Window()
batch = pyglet.graphics.Batch()
label = pyglet.text.Label(
"Hello, world",
font_name="Times New Roman",
font_size=36,
x=window.width // 2,
y=window.height // 2,
anchor_x="center",
anchor_y="center",
batch=batch,
)
@window.event
def on_key_press(symbol, modifiers):
label.delete()
@window.event
def on_draw():
window.clear()
batch.draw()
pyglet.app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment