GUIs - A Modest Proposal

Brian Blais bblais at bryant.edu
Thu Jun 10 07:08:51 EDT 2010


On Jun 10, 2010, at 4:28 , Gregory Ewing wrote:

> Brian Blais wrote:
>
>> In this whole discussion, I haven't seen anyone mention wax (http://
>> zephyrfalcon.org/labs/wax_primer.html)
>
> Just had a quick look at that. In the third example code box:
>
>    def Body(self):
>        ^^^^
>      self.textbox = TextBox(self, multiline=1, wrap=0)
>      self.AddComponent(self.textbox)
>           ^^^^^^^^^^^^
>
> Here's something unpythonic already: a couple of non-pep-8-compliant
> method names.
>
> And a bit further down:
>
>      self.textbox.SetFont(FIXED_FONT)
>                   ^^^^^^^
>
> Using a setter method instead of a property.
>
> So while it's quite likely better than raw wxPython, it fails the
> pythonicity test for me.

I hope I didn't imply that it was perfect.  :)  It's definitely much  
easier than raw wx, and I think it is a reasonable starting point.   
Some of the things that you pointed out are very easily fixed, and  
are there because of some wx quirks.  AddComponent could easily be  
renamed to append, for the same meaning.  Many other wx getters/ 
setters are done with properties or attributes, so it is in the right  
direction.
>
>> I wonder if that sort of philosophy would work: a really nice and
>> clear, pythonic wrapper around a sophisticated, complex, and complete
>> GUI framework. ...  Depending on how it is designed, it might  
>> even  be
>> possible to have a multi-framework wrapping, so that someone  
>> could  have
>> a Qt-based wrapper, and another using the same module choose to   
>> have it
>> wrap wx.
>>
>
> That's more or less what PyGUI is meant to be, except that the
> frameworks currently wrapped are Cocoa, Gtk and pywin32. There's
> also a slight difference in emphasis, since PyGUI aims to leverage
> platform functionality as much as possible, rather than rely on
> a large third-party library that duplicates much of that  
> functionality.


I've tried PyGUI about 6 months ago, and it seemed like a good start,  
but missing a lot of what I would need.  I also am not very fluent in  
MVC (having developed all my bad GUI habits from years of matlab  
programming), so the structure wasn't particularly intuitive.  I just  
tried it again a few days ago, and couldn't get it running on my  
system, which is a bit old (OS X Tiger).

Since many seem to be married to a particular GUI framework, I was  
just suggesting that a thin wrapper around the framework might be  
fruitful, with wax as a working proof-of-concept. That way, when  
there is a limitation, one can fall back on the underlying framework  
easily.  Wrapping an already cross-platform framework would seem to  
get the most bang for the buck.


					bb
-- 
Brian Blais
bblais at bryant.edu
http://web.bryant.edu/~bblais
http://bblais.blogspot.com/






More information about the Python-list mailing list