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 36. The Mouse Odometer > Composite Widgets

36.4. Composite Widgets

At last it’s time to discuss Perl/Tk composites featuring, of course, the odometer widget. The OO tables have turned and now you become a designer rather than a mere user! An odometer widget “ISA” frame. That is, it’s a subclass of a frame widget: odometer objects are simply “mega-widgets” composed of standard Tk widgets packed inside a frame (we’ll see what “ISA” is all about shortly). There are other kinds of extended widgets: a dialog widget ISA a top-level, while an axis widget is derived from, or “kind of,” a canvas. A common attribute of all these extended widgets is that they behave just like standard Tk widgets, basically because Nick took great pains to ensure they do.

Since an odometer is contained in a frame you can create an instance and pack it inside your application just like, say, a button. Let’s create a default odometer and add one millimeter to it:


  

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