[Python-3000] GUI -- an API, not a toolkit

Giovanni Bajo rasky at develer.com
Thu May 11 00:54:13 CEST 2006


Josiah Carlson wrote:

>> Show me a combo-box with selects among items with both text and a
>> bitmap, done with wxPython, on all platforms.
>
> How about I describe how one can make it happen?
>
> There was a somewhat recent post in wxpython-users which offered a
> reimplementation of wx.PopupWindow (previously not available on Mac).
> There was another post which overrode the various "show me the choices
> command" for a wx.ComboBox (or wx.Choice, I can't remember, and they
> are almost the same) to show in a wx.PopupWindow, a tree rather than
> a list. It also offered a fairly simple method to replace that tree,
> list, etc., with an arbitrary control of the user's choosing.
>
> By using a wx.ListCtrl, one can embed icons to the left of rows
> arbitrarily.  Couple this "embed arbitrary controls for the
> wx.ComboBox", and the "new wx.PopupWindow" implementation, and you
> have all of the building blocks necessary.
>
> Is that sufficient?

It's sufficient to show that a library that uses native widget has to go
through many hoops to implement any slightly non-standard feature. And
causes the mental overhead which makes it unpythonic.

Compare this with PyQt. You create a QComboBox (you wanted a combobox), and
you can set a text and/or a pixmap for each item, using self.insertItem(px,
txt). Qt can export a much better, friendly and well-designed API because it
doesn't rely on native widgets. It draws the widgets itself, so they always
have the very same features for all the platforms that Qt supports. For
instance, the other day I shrinked a horizontal scrollbar in the vertical
direction (make it look "smaller"). It worked immediately for Windows, Mac
and Linux. I don't think Windows can have a "smaller" scrollbar at all, for
instance, at least not without adjusting its theme.

OK, this is totally off-topic. I guess we can continue in private mails...
-- 
Giovanni Bajo



More information about the Python-3000 mailing list