Miscellaneous

The following is a list of miscellaneous widgets offered by Pmw:

  • Balloon
  • Blt (used for graph generation)
  • The Color Module functions
Pmw offers a large list of extended widgets. For a demonstration of all these widgets, browse the Pmw package that you installed earlier and look for a directory named demo. Within demo, look for a file named All.py, which demonstrates all of these Pmw extensions with a sample working code.

Pmw provides the Balloon widget implementation, which will be used in the current example. Begin by importing Pmw into the namespace, as follows (see code 5.09view.py):

import Pmw 

Next, instantiate the Balloon widget within the create_gui method, as follows:

self.balloon = Pmw.Balloon(self.root) 

Finally, bind the Balloon widget to each button widget in the audio player. We will not reproduce the code for each button. However, the format is as follows: 

balloon.bind(name of widget, 'Description for the balloon') 

Thus, the Add File button will have a balloon binding, as follows:

self.balloon.bind(add_file_button, 'Add New File') 

Add similar code for each button in 5.09view.py.

This completes the iteration. We added Balloon tooltips to the audio player's buttons using the Pmw Tkinter extension. Most importantly, we got to know about the Tkinter extensions and when to use them.

When you need a widget implementation that is not available as a core widget, try looking for its implementations in Pmw or TIX. If you don't find one that suits your needs, search the internet for some other Tkinter extension. If you still don't find your desired implementation, it's time to build one.

This brings us to the end of this chapter. The audio player is ready!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.34.25