When you run scalingobjects.py, you will notice a familiar scene of a blue grid with two cubes on top of each other. The whole scene will, however, be rotating, thanks to some leftover code in Object . py. Let's remove this as it will no longer be needed, and while we are modifying the code, we will add new lines to work with scaling.
Open object . py and modify the update method, like this:
def update (self, events = None):
glPushMatrix ()
for $c$ in self.components:
if isinstance (c, Transform) :
pos $=$ c.get_position ()
scale $=$ c.get_scale ()
glTranslatef(pos.x, pos.y, pos.z)
glscalef(scale.x, scale.y, scale.z)
elif isinstance (c, Mesh3D) :
.
This code gets the object's scale from the Transform class, and then uses the glScalef () OpenGL method to set the scales of the $x, y$, and $z$ coordinates separately.