[Python-talk] how do I ? wxpython & python related

Kent Johnson kent37 at tds.net
Thu Jul 16 17:08:38 EDT 2009


On Thu, Jul 16, 2009 at 4:21 PM, <bruce.labitt at autoliv.com> wrote:
> I am looking at using wxpython to simplify my user interface which has
> grown bulky over time.  I have 8 radioboxes with some choices that the
> user needs to make.  I have gotten to the point where I can determine
> which radiobox and which radiobutton in that box have been selected.  My
> plan is to have a go button on the frame.  This button will be enabled
> once the setup has been completed.  (I don't know yet how to do this, but
> that is not the question.)
>
> 1.  Should I log the button / panel presses while the main loop runs, or
> 2.  After the 'GO' button is pressed, somehow poll the current status of
> all the buttons/boxes/widgets?
>
> For 1, I would need to create a 'global' variable(s) that are kept up to
> date.  How are globals done in python, or is that a stupid question?
>
> For 2, is there a way to do this in wxpython?  I thought it was all event
> driven - is the state saved anywhere?

I would do 2. The state is saved in the widgets. I'm not familiar with
wx, but one way to do this would be to save references to the
radiobuttons when you create them, typically in attributes of the
contaning class. Then the handler for the GO button can retrieve the
state of the radiobuttons and do the work.

Kent


More information about the Python-talk mailing list