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 doe
Here you are using pyglet.graphics.Batch()
to render the shape objects together i.e. test(the first rectangle) + the second rectangle. A batch manages a set of objects that will be drawn at once, and hence to instantiate the objects that need to be drawn, they need to have a reference against which they can be mapped to that batch.
To draw a rectangle as is, without assigning it to a varible can be done by using the pyglet.graphics.draw()
function directly by passing in the primitive type, rectanggle coordinates and formatstring.