Skip to content

Instantly share code, notes, and snippets.

@olehermanse
Created May 25, 2019 00:06
Show Gist options
  • Save olehermanse/058c0588f441277fd2d27379f77a2ef4 to your computer and use it in GitHub Desktop.
Save olehermanse/058c0588f441277fd2d27379f77a2ef4 to your computer and use it in GitHub Desktop.
Added resize
import pyglet
window = pyglet.window.Window(resizable=True)
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')
@window.event
def on_draw():
window.clear()
label.draw()
@window.event
def on_resize(w, h):
label.x = w // 2
label.y = h // 2
pyglet.app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment