up with PyGUI!

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Sep 29 01:52:35 EDT 2004


Peter Hansen wrote:
> class MainFrame(FrameDescription):
>     b1 = ButtonDescription(
>         size = (40, 40),
>         text = "b1",
>         )
> 
> That's pretty close to what you asked for.  You're welcome,
> in advance. <wink>

The idea was to be able to specify attributes of the
widget using a suite of assignments instead of a function
call. Not a big difference, but it would tidy things up
a bit and avoid those awkward dangling parentheses that
you get with the above style.

My example was a little off target, btw. It should
have been more like

   class MyWindow(Window):

     def __init__(self):

       instance b1(Button):
         size = (40, 40)
         text = "b1"

i.e. the created objects are to be attributes of
*instances* of MyWindow, not its class.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list