12.7 An Improved Implementation

The solution to the problem outlined previously is valuable to understand because it will help you recognize the principles behind many professional graphics systems, including the TKinter graphics system used by Python. It also helps you understand what is happening in the graphics systems used in the Java programming language. Another benefit of the solution is that once you have the mechanism in place to solve the current problem, you will be able to implement a move method for all graphics objects very easily.

The solution to the problem begins with two additional instance variables for the GeometricObject class and one additional instance variable and one more method for the Canvas class. For the GeometricObject ...

Get Python Programming in Context, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.