■ You can create a minimal wxPython program in less than 10 lines of code. Most wxPython programs are much longer than 10 lines, and are typically divided into separate modules, each containing customized subclasses of wxPython classes, and, hopefully, plenty of docstrings.

■ Most of the wxPython toolkit is accessed through the wx package which you access using the import wx statement. Every wxPython program must have an application object—an instance of a wx.App subclass that defines an OnInit() method. Most wxPython programs will have one or more frames—instances of subclasses of wx.Frame. A frame is the large, movable, resizeable window-like container that appears on screen, often with a menu, status bar, tool bars, and other widgets. Control of your program passes to wxPython when you call your application's MainLoop() method.

■ Within wxPython are all the basic widgets you would expect, plus common dialogs, a wide variety of more complex widgets, HTML rendering, spreadsheet-style grids, and so forth. The wxWidgets toolkit that wxPython is based on is a C + + framework with a large list of features. It is a cross-platform toolkit, with most support for Microsoft Windows, Unix GTK+, and the Mac OS. The basic unit of a wxWidgets application is the window, meaning any item that can be drawn to the screen.

■ The wxPython toolkit is a combination of the Python programming language and the wxWidgets toolkit and can be downloaded at www. It combines a very extensive interface toolkit with an easy-to-use scripting language. It offers productivity gains and useful features for any programmer, including existing Python or wxWidgets programmers.

■ The wxPython version of the toolkit is a wrapper around wxWidgets containing bindings which allow Python language constructs to interact with the C + + framework. These bindings are largely created from the SWIG tool, from a long list of descriptions of how Python objects and C + + objects relate to each other.

Now it's time to do some wxPython coding. The next chapter starts you off with writing some code, and the remainder of part 1 explores the most important concepts of wxPython. Let's go!

Was this article helpful?

0 0

Post a comment