You may recall that images take time to load. Your program continues running, but the image may not be loaded across the internet for a moment or two. During that time, it doesn't have any dimensions.
Our add_pipe function makes use of MyImg.height. Big problem.
If only there was some way of delaying our calls to add_pipe until we knew the pipe_piece image had fully loaded and received its dimensions.
Turns out there is.
|