Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyglet
- #showing the main window and the main label
- window = pyglet.window.Window(800, 600, "Hi!")
- label = pyglet.text.Label('Hello world!',
- font_name='Arial',
- font_size=28,
- x=window.width//2, y=window.height//2,
- anchor_x='center', anchor_y='center')
- #defining the color of the background(?)
- @window.event
- def on_draw():
- window.clear()
- label.draw()
- #defining what happens when you press a key
- def on_key_press(symbol, modifiers):
- label1 = pyglet.text.Label('A key was pressed',
- font_name='Arial',
- font_size=20,
- x=window.width//2, y=window.height//2,
- anchor_x='center', anchor_y='bottom')
- pyglet.app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement