In the same Scalingobjects. py code, references to cube2 can be removed before the main game loop, the spacebar controls removed, and the up- and down-arrow keys programmed to scale the cube up and down, like this:
.
glviewport (0, 0, screen.get_width(),
screen.get_height ())
glEnable (GL_DEPTH_TEST)
trans: Transform $=$ cube.get_component (Transform)
while not done:
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
done = True
keys = pygame.key.get_pressed()
if keys[pygame.K_UP]:
trans.set_scale(pygame.Vector3(2, 2, 2))
if keys[pygame.K_DOWN]:
trans.set_scale(pygame.Vector3(0.5, 0.5, 0.5))
glPushMatrix()