Classes

Newt newt_e at blueyonder.co.uk
Mon Nov 11 16:50:16 EST 2002


"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1037020816.31691.python-list at python.org...
>
[ ...snip... ]
> No "self" is needed.  To create a class which has three explicit
parameters,
> define it as
>
>     class ClassName:
>         def __init__(self, one, two, three):
>             ...
>
> then instantiate it like so:
>
>     instance = ClassName(a,b,c)
>
How would I do this if I wanted to get a response back? If for example the
screen listed 5 buttons, each with a piece of text. I want the use to click
on the button. This would then close the screen, and I'd get my response
back, which would tell me which button was pressed or something.
>     newt> Is the correct way to do this: in the class module, get the
>     newt> __init__ to do not very much, and then call the do_widgets
>     newt> routine?
>
> In all depends.  How complex are your screens?  How dynamic are they (do
> widgets come and go)?  What initialization is repeated each time a screen
is
> displayed?
>
No, that not that complex. One has a series of buttons, arranged in 4 groups
of 5. One is a text only screen (a bit like a help screen). Widgets are
fixed, but the name displayed in Labels might change.
> --
> Skip Montanaro - skip at pobox.com
> http://www.mojam.com/
> http://www.musi-cal.com/
>

Newt





More information about the Python-list mailing list