October 2019
Beginner to intermediate
498 pages
14h 13m
English
Let’s begin with a top-down implementation of the portion of the class hierarchy needed to implement the program in Listing 12.2. We will start with the Canvas class (shown in LISTING 12.3), which serves the same purpose for our graphics module as it does for the turtle. It is a place for us to draw GeometricObjects. In fact, because we are using the turtle to do all of our behind-the-scenes drawing, we will make use of the same window and canvas as the turtle. This decision saves us a lot of work but also has some important ramifications for our program. For example, it means that we will use the turtle’s coordinate system.
LISTING 12.3 The Canvas class
Canvas ClassThe most difficult task in writing ...
Read now
Unlock full access