On Tue, 2003-09-09 at 08:40, I�igo Serna wrote:
> first, thanks for the help, but it doesn't work.
> 
> El mar, 09-09-2003 a las 16:36, Christian Reis escribi�:
> > The correct answer to your inquiry is, of course, "Why do you want to do
> > that?"; however:
> 
> I want to control the state of a varible (in fact, the visibility of the
> grid of the second question) from two places: CheckButton in a menu
> entry and ToggleButton in the UI.

I'm using the same technique. However, I did one thing a little
differently. I have a function called 'Run' - I want the user to be able
to start and stop the running of something.

I created a run toggle, and a run menu item. The key is they BOTH call
the same signal handler: on_run_button_toggled()

    def on_run_button_toggled(self, widget, event=None):
        x = widget.get_property('active')
        self.world.set_running( x )
        self.widget['togglebutton'].set_active(x)
        self.widget['run1'].set_active(x)

This works correctly, and doesn't require the use of a semaphore
variable (one of the set_actives() will always be redundant, but that
doesn't matter).  It also forces the state of both widgets to be the
same, so you can't get them out of sync with each other (which could
happen if you simply flip their states, and somehow only flip one of
them).

Regards,
  cf
-- 
Colin Fox <[EMAIL PROTECTED]>
CF Consulting Inc.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to