The correct answer to your inquiry is, of course, "Why do you want to do
that?"; however:

On Tue, Sep 09, 2003 at 04:28:36PM +0200, Iņigo Serna wrote:
> I have a problem when sharing a value depending on the state of 2
> widgets. 

You have the answer in your hand: you need to use a shared lock
variable.

>     def onCheckToggled(self, check):
>         print self.opt,
>         if self.opt:
>             self.opt = 0
>         else:
>             self.opt = 1
>         print self.opt,
>         self.label.set_text('Option: %d' % self.opt)

    if not self.block_toggle:

        self.block_toggle = 1

>         self.toggle.set_active(self.opt)

        self.block_toggle = 0

>         print self.opt

-- and the same code here

>     def onToggleToggled(self, toggle):
>         print self.opt,
>         if self.opt:
>             self.opt = 0
>         else:
>             self.opt = 1
>         self.label.set_text('Option: %d' % self.opt)

    if not self.block_toggle:

        self.block_toggle = 1

>         self.check.set_active(self.opt)
        
        self.block_toggle = 0

Don't know about gnomecanvas, but I suspect there's a better way.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
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