Skip to content

Instantly share code, notes, and snippets.



Created Jul 14, 2020
What would you like to do?
#!/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 =
# 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)
def on_draw():
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.