■ Most wxPython programs use common elements such as menus, toolbars, and splash screens. Using them helps the usability of your program and makes it look more professional. In this chapter we used a simple sketch application and enhanced it with a toolbar, status bar, menu bar, common dialogs, a complex layout, and an about and splash box.
■ You can draw directly to the wxPython display by using a device context. Different kinds of displays require different device context classes, however, they all share a common API. Device contexts can be buffered for smoother display.
■ A status bar can be automatically created at the bottom of a frame. It can contain one or more text fields, that can be sized and set independently.
■ Menus can contain nested submenus, and menu items can have toggle states. Toolbars emit the same kinds of events as menu bars, and are designed to be easy to lay out groups of tool buttons.
■ Opening and saving your data can be managed with the standard wx.File-Dialog. Colors can be chosen using wx.ColourDialog.
■ Complex layouts are created without explicitly placing each widget using siz-ers. A sizer automatically places its child objects according to a set of rules. Sizers include wx.GridSizer, which lays objects out in a two-dimensional grid, and wx.BoxSizer, which lays items out in a single line. Sizers can be nested, and can also control the behavior of their children when the sizer is stretched. ■ An about box, or other simple dialog, can be created using wx.html.Html-Window. Splash screens are created using wx.SplashScreen.
In part 1, we've covered the basic concepts behind wxPython, and we've also covered some of the most common tasks. In part 2, we'll use the now familiar question-and-answer format, but we'll ask more detailed questions about the makeup and functionality of the wxPython toolkit.
Was this article helpful?