FXPy 1.0.5 review
DownloadFXPy is a Python extension module which provides an interface to the FOX cross-platform GUI library
|
|
FXPy is a Python extension module which provides an interface to the FOX cross-platform GUI library.
The FXPy API follows the standard FOX API very closely and for the most part you can use FOX documentation as a reference. But of course, Python isn't C++ and so here are some differences of which you should be know.
Any function which usually takes an FXString as an input instead takes a Python string. Similarly, functions which usually return an FXString will instead return a Python string. For functions which would accept a NULL or empty string argument, just pass an empty string ("") or None.
In FOX, message maps are defined as static class members. In FXPy, you just associate messages with message handlers in the class constructor using the FXMAPFUNC(), FXMAPTYPE(), FXMAPTYPES() or FXMAPFUNCS() methods. See almost any of the example programs for examples of how this is done.
As in C++ FOX, the last argument passed to your message handler functions contains message-specific data. For instance, all SEL_PAINT messages pass an FXEvent object through this argument to give you some information about the size of the exposed rectangle. On the other hand, a SEL_COMMAND message from an FXHeader object passes the index of the selected header item through this argument. Instead of guessing what's in this last argument, your best bet is to instead invoke a member function on the sending object to find out what you need, instead of relying on the data passed through this pointer.
For example, if you get a SEL_COMMAND message from an FXColorWell object, the data passed through that last argument is supposed to be the new RGB color value. Instead of trying to interpret the argument's contents, just turn around and call the color well's getRGBA() member function to retrieve its color. Similarly, if you get a SEL_COMMAND message from a tree list, call its getCurrentItem() method to find out which item was selected.
FXPy 1.0.5 search tags