Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

If you load a new .gif into your Image object, then it will go back to being the original image size.

Then you can resize it, but the player may still see it as the wrong size briefly, because by default the GraphWin updates it's graphics continuously, after each change.

This can also cause performance problems (especially on Mac computers) because too many graphics updates can slow things down.

How can we fix this?

asked in CSC201 Spring 2021 by (508 points)

1 Answer

+3 votes

To fix this, you probably need to use the autoflush=False option when you create the GraphWin, and call update() manually to update the graphics. This should also result in smoother animation for moving large numbers of envelopes.

This is discussed in 4.8.6 in the textbook, on page 121. I think it's also in the graphics reference pdf.

Note: there's also a danger to using autoflush=False, because then you may miss things that happen on the screen if you don't call the update() function to make sure that the graphics get updated. This can also be harder to debug, so I don't recommend changing autoflush to False until near the end, when you have things working and just want to get smoother graphics performance.

answered by (508 points)
...