Why do shapes and other objects in pyglet have to be named (as in assigned variables) ? The Rectangle below named "test" renders successfully, the one a line below does not. Why is that?
from pyglet import shapes
WHITE = (255, 255, 255)
HEIGHT = 1080
WIDTH = 720
window = pyglet.window.Window(HEIGHT, WIDTH)
background = pyglet.graphics.Batch()
test = shapes.Rectangle(200, 200, 50, 50, color=WHITE, batch=background) # Renders successfuly
shapes.Rectangle(300, 300, 50, 50, color=WHITE, batch=background) # Does not render
@window.event
def on_draw():
window.clear()
background.draw()
pyglet.app.run()