Created
July 14, 2020 03:20
-
-
Save llimllib/d66feb4cd3f8adc70331ff7b3cd42ba0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
import pyglet | |
from pyglet import shapes | |
WIDTH = 960 | |
HEIGHT = 540 | |
RED = (255, 0, 0) | |
window = pyglet.window.Window(WIDTH, HEIGHT) | |
# the pyglet documentation strongly suggests to draw with a batch, not an | |
# individual shape, so, FINE | |
batch = pyglet.graphics.Batch() | |
# this needs to be a global variable to avoid being garbage collected | |
c = shapes.Circle(WIDTH // 2, HEIGHT // 2, HEIGHT // 10, color=RED, batch=batch) | |
@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