Creating and using wxPython menus

This chapter covers

■ Creating menus

■ Working with menu items

■ Adding submenus, pop-up menus, and custom menus

■ Usability guidelines for menus

It's difficult to imagine an application without the familiar bar at the top starting with File and Edit and ending with Help. Menus are such a common part of the standard interface kit that they tend to fade into the background without drawing much attention. That's too bad, because the way that menus give the user access to all functionality quickly and easily was truly revolutionary.

In wxPython, there are three primary classes that manage menu functionality. The class wx.MenuBar manages the menu bar itself, while wx.Menu manages an individual pull-down or pop-up menu. A wx.MenuBar instance can, of course, contain multiple wx.Menu instances. The class wx.MenuItem represents one specific item within a wx.Menu.

In chapter 2 we provided a brief introduction to menus, in listing 5.5 we provided a mechanism for easily creating menu items, and in chapter 7 we introduced information on special menu effects. In this chapter, we will provide more detail on the creation and use of wxPython menus.

Was this article helpful?

0 0

Post a comment