up with PyGUI!

Nicolas Fleury nid_oizo at yahoo.com_remove_the_
Thu Sep 23 14:33:53 EDT 2004


Hans Nowak wrote:
> I'm not sure it's *that* much easier... all you're saving is one parameter.

Easier is probably not the good word.  It is less redundant and less 
error-prone.  It has happened to me to make mistakes in ownership of 
widgets when copy-pasting code, when these errors would not have occured 
if the parent parameter was not passed.

It is also more usable, since you can do things like:
myFrame.SetMenuBar(MenuBar([
     Menu("File", [
         Item("&New\tCtrl+N", self.onNew),
         Menu("Some sub menu...", ...)]
     Menu("Edit", ...)]

The problem is that that explicit cross-referencing between parent and 
child forces the parent to be created before, removing capabilities like 
that one.

>> 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.

I honestly don't know.  I guess a solution could be to create a frame in 
two passes, and the wx.Frame created after the first pass is used as 
parent of everything created in second pass.

Also, the wxPython mechanism could be completely hidden behind the 
wrappers.  The wrappers can contain all necessary information to create 
the widgets, allowing widgets to be created with a parent when addded to 
it and even recreated with another parent if added later to something 
else.  This way the user will not even have to think about the ownership 
  issue.

> 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.

Sorry, I though they were complete wrappers as in PythonCard.  I totally 
agree to keep things that way if wx widgets are inherited.

Regards,
Nicolas



More information about the Python-list mailing list