up with PyGUI!

Hans Nowak hans at zephyrfalcon.org
Thu Sep 23 13:29:39 EDT 2004


Nicolas Fleury wrote:
> What I'm suggesting is to avoid the redundacy and do:
> parent.Add(Button(...))
> 
> I've done it for some GUI framework where I work encapsulating wxPython. 
>  The drawback is that you need to delay the creation of widgets, which 
> means some attributes might be stored twice.  But it's definitely easier 
> to use.

I'm not sure it's *that* much easier... all you're saving is one parameter.

> Another thing I'm suggesting is a mechanism to not destroy a widget 
> until it's corresponding python object is destroyed.  It's more complex, 
> but Python has already ownership with refcount, garbage collection, etc. 
> and I think a truly pythonic GUI framework should use the same ownership 
> mechanism.

Hm.  I'm not sure how wxPython handles that, and if it would be possible to 
impose such a system on top of it.

>>> It could also be a good idea to take the occasion to respect PEP8.  
>>
>> Which recommendations of the style guide does the Wax code violate?
> 
> IIRC, method names beginning with lowercase, as all the Python API.

Wax follows the wxPython standard here.  Since most Wax controls derive 
directly from wxPython classes, it would make little sense to add lowercase 
methods to the mix (next to the existing uppercase methods), or to convert them.

>>> Note also that "import wax" would be better than "from wax import *".
>>
>> I'm considering it.  This way, it would also be possible to import 
>> things on demand.  On the other hand, I don't like to write 'wax.' 
>> before everything.
> 
> It's just that when you work multiple modules, autocompletion for a 
> module doing a "from wx import *" is a nightmare (and is also slowing 
> debuggers, since so many symbols are in each module namespace).  If wax 
> becomes big, it would also be a pain.  You can do "import wax as w" ;)

I personally like 'from wax import *', kind of like how Tkinter is usually 
imported.  Either way currently works, though.  Should I use the "lazy" 
importing (which is admittedly useful), then the star-import would not be 
possible anymore, I think.

--
Hans Nowak (hans at zephyrfalcon.org)
http://zephyrfalcon.org/




More information about the Python-list mailing list