book on wxPython?

Roger Binns rogerb at rogerbinns.com
Sun May 16 22:33:37 EDT 2004


Grant Edwards wrote:
> Not realizing that the containment and layout trees are
> _separate_ is half of what made wxPython apps appear to be a
> mess.

Many programmers aren't even used to the idea of layout
hierarchies.  It is very ingrained of you have ever done
Tk or Motif, but not something you will know about as a
Windows programmer.

> Perhaps that fact was obvious to everybody else, but I missed it
> completely.

I don't think it is obvious at all.  There is an overview about
them in the doc, as well as some pages in the wiki.

> [I still think the whole integer ID thing should be hidden from
> the programmer, but perhaps a light will come on one of these
> days and that will then make sense to me as well.]

I use them because I have menu items, toolbar buttons and buttons
in HTML that all need to reference the same thing.  An integer
ID does the trick nicely.

>  [I'm still a bit
>   foggy on the function of the parent-child relationship in
>   wxWidgets.]

A child widget is within its parent - it will be clipped to
its parent, and is drawn on top of its parent.  Some events
(eg command events) are delivered to a widget and if it
doesn't handle them then sent up the containment hierarchy.

> I've heard all sorts of nasty things
> about Motif, so I never tried it.

I worked for the company that at one point had 70% of the
worldwide Motif market.  At that time it had i18n features,
a resource system noone used (not the same as Xt resources,
but more like XRC in wxWidgets), and portability to the
many flavours of UNIX.  (I once used Sony UNIX - yes it
really existed).

Then CDE came along and the rest is history.

> I'm definitely going to stick with it.  I blundered my way
> though writing and shipping one small wxWindows app a while
> back. Now that I've figured out the two-tree thing, it should
> be easier.

The best advice I can give you is to seriously examine the
XRC stuff.  The XRC editor even comes with wxPython.  That
will let you abstract out your user interface code (especially
the issues to do with layouts and parent relationships).
I just wish I had done it.

Roger





More information about the Python-list mailing list