Created
May 25, 2019 00:06
-
-
Save olehermanse/058c0588f441277fd2d27379f77a2ef4 to your computer and use it in GitHub Desktop.
Added resize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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