Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 39. Drawing on a Canvas > A Canvas Widget Is the Lawn

39.2. A Canvas Widget Is the Lawn

To represent the mowing area, we’ll use a Perl/Tk canvas widget, colored chlorophyll green of course. Let’s assume that to program the mower all we need is to write Perl/Tk code that overlays various items that display the mower’s path (lines, arcs, ovals, and such) on the canvas, making sure that no green remains.

Our first program starts by mowing (drawing a line) 100 feet in a straight line and turning right. It repeats three times until it’s mowed the periphery of the lawn. Then the mower shifts right by the width of one cut (I mow clockwise) and repeats the process until there’s nothing left to mow.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint