ANN: wxPython

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

ANN: wxPython

Robin Dunn

The release of wxPython is now available for download at  This release has had a number of
further refinements and enhancements on the stable 2.8 source tree
since the previous release.   On Mac OS X 10.5 (Leopard) the Python
2.5 binaries of wxPython are able to be used with either Apple's
system Python, or with the version.

Source code is available, as well as binaries for Python 2.3, 2.4 and
2.5, for Windows and Mac, as well some packages for various Linux
distributions.  A summary of changes is listed below and also at

What is wxPython?

wxPython is a GUI toolkit for the Python programming language. It
allows Python programmers to create programs with a robust, highly
functional graphical user interface, simply and easily. It is
implemented as a Python extension module that wraps the GUI components
of the popular wxWidgets cross platform library, which is written in

wxPython is a cross-platform toolkit. This means that the same program
will usually run on multiple platforms without modifications.
Currently supported platforms are 32-bit Microsoft Windows, most Linux
or other Unix-like systems using GTK2, and Mac OS X 10.3+, in most
cases the native widgets are used on each platform to provide a 100%
native look and feel for the application.

Changes in

Added the PlateButton class from Cody Precord.

Added wx.PyEvtHandler, which supports overriding the ProcessEvent
method in derived classes.  Instances of this class can be pushed onto
the event handler chain of a window in order to hook into the event
processing algorithm, and its ProcessEvent method will be called for
every event sent to the window.

With much help from Anthony Tuininga the code generated by the img2py
tool is now cleaner, simpler and smaller.  Instead of writing the data
for the images as printable ascii with hex escapes it now uses base64
to encode the images into a string.  In addition, instead of top-level
functions for returning the image data and bitmaps, the embedded
images now use a simple class with methods for returning the image as
a bitmap, icon, or etc.  By default in 2.8.x top-level aliases will be
generated to make the code backward compatible with the old functional
interface, but you can use -F to turn that off.  In 2.9 and beyond the
default will be to generate only the new class interface, but -f can
be used to turn the old behavior back on.

The PyEmbeddedImage class added for the new img2py support can also be
used for image data that may be acquired from some other source at
runtime, such as over the network or from a database.  In this case
pass False for isBase64 (unless the data actually is base64 encoded.)
Any image type that wx.ImageFromStream can handle should be okay.  See
the wx.lib.embeddedimage module for details.

Exposed the wx.GenericDatePickerCtrl to wxPython.  On wxGTK and wxMac
this is exactly the same as the normal date picker, but on wxMSW it
allows you to avoid the native wx.DatePickerCtrl if so desired.  Also
fixed a bug that caused an assert if you tried to set the date to
wx.DefaultDateTime even if wx.DP_ALLOWNONE was specified.

Made a little hack in wx.lib.masked.TextCtrl that allows it to be
wrapped around an already existing TextCtrl instead of always creating
its own.  This is useful for example with the wx.TextCtrl that is
built-in to the customizable wx.combo.ComboCtrl, or with a textctrl
that is part of an XRC layout.  To use it you need to do a little
trick like this::

        existingTextCtrl = combo.GetTextCtrl()
        maskedCtrl = wx.lib.masked.TextCtrl.__new__(wx.lib.masked.TextCtrl)
        maskedCtrl.this = existingTextCtrl.this

Enhanced the Widget Inspection Tool with some new functionality.
Added tools to the toolbar to expand and collapse the widget tree,
which is very helpful for not getting lost in very large applications
with many hundreds of widgets.  Also added a toolbar tool for
highlighting the currently selected widget or sizer in the live
application.  The tool will flash top-level windows and for all other
items it will draw an outline around the item for a few seconds.

Copied the sized_controls module to the wx.lib package as the first
step of phasing out the wxaddons package.

Added an implementation of wx.Window.SetDoubleBuffered on Windows.
(GTK already has one, and Mac doesn't need one because everything is
always double buffered by the system there.)

Added a wrapper to wx.TopLevelWindow for MacGetTopLevelWindowRef to
facilitate calling the Carbon APIs directly for things that are not
supported in wx, similar to how we can use ctypes or PyWin32 with
window.GetHandle() to do custom stuff on Windows.  (On wxMac GetHandle
returns the ControlRef, which is different than the WindowRef, hence
the need for a 2nd method.)  Here is an example to set the modified
flag in the caption::

     >>> import ctypes
     >>> carbon = ctypes.CDLL('/System/Library/Carbon.framework/Carbon')
     >>> carbon.SetWindowModified(frame.MacGetTopLevelWindowRef(), True)

Added a new light-weight solution for embedding ActiveX controls in
wxPython applications that uses ctypes and the comtypes package
available from
Comtypes allows us to use and provide an interface with full dynamic
dispatch abilities, much like PyWin32's COM interfaces but with much
reduced external dependencies.  See wx/lib/ for more
details.  IMPORTANT: Be sure to get at least version 0.5 of comtypes,
see the docstring in the wx.lib.activex module for details.

The wx.lib.iewin, wx.lib.pdfwin, and wx.lib.flashwin modules were
switched to use the new and improved activex module.  The APIs
provided by these modules should be mostly compatible with what was
there before, except for how the COM events are handled.  Instead of
sending wx events it relies on you overriding methods with the same
names as the COM events.  You can either do it in a or derived class,
or you can set an instance of some other class to be the event sink.
See the ActiveX_IEHtmlWindow sample in the demo for an example.  If you
would rather continue to use the old version of these modules they are
available in the wx.lib with "_old" added to the names.

Added the wx.lib.resizewidget module.  This module provides the
ResizeWidget class, which reparents a given widget into a specialized
panel that provides a resize handle for the widget. When the user
drags the resize handle the widget is resized accordingly, and an
event is sent to notify parents that they should recalculate their

Robin Dunn
Software Craftsman  Java give you jitters?  Relax with wxPython!

wx-announce mailing list
[hidden email]