Re: [pygtk] Avoiding recursive event loops... or using better toggle buttons

2006-03-15 Thread Frederic Peters
Ricardo Staudt wrote:

 Yes, exactly. Also if anyone can explain how I can also avoid the recursion
 problem when calling for events within event function, that would also be 
 nice.

I hope I understood your problem; here is basically what I do:

  togglebutton1.connect('toggled', on_toggle_1)
  togglebutton2.connect('toggled', on_toggle_2)

  def on_toggle_1(widget):
  togglebutton2.set_active(not widget.get_active())
  if widget.get_active():
   pass # do this
  else:
   pass # do that

  def on_toggle_2(widget):
  togglebutton1.set_active(not widget.get_active())




Frederic
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Avoiding recursive event loops... or using better toggle buttons

2006-03-14 Thread Steve McClure
On Tue, 2006-03-14 at 15:41 -0300, Ricardo Staudt wrote:
 Hello everyone, this is a tricky question:
 
 I'm trying to make a list of toggle buttons that, when one is pressed, 
 the others are unpressed. I don't see a way to link them to do this 
 automatically (if you guys know, please let me know), so I what I try is 
 something like this:
 
 Whenever one Toggle button is clicked, it raises the click event, there 
 (inside the event function) I unpress all others by hand.
 
 The problem is that when I unpress them it calls for the same click 
 event function, causing a recursion limit error. Any ideas?

It sounds like you want the behavior of RadioButtons instead of just
ToggleButtons.

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]  380 Interstate North 
Pkwy, SE
voice: 404-892-5850 Suite 250
fax: 404-892-7215   Atlanta, GA 30339
http://www.racemi.com

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Avoiding recursive event loops... or using better toggle buttons

2006-03-14 Thread Ricardo Staudt




Steve McClure wrote:

  On Tue, 2006-03-14 at 15:41 -0300, Ricardo Staudt wrote:
  
  
Hello everyone, this is a tricky question:

I'm trying to make a list of toggle buttons that, when one is pressed, 
the others are unpressed. I don't see a way to link them to do this 
automatically (if you guys know, please let me know), so I what I try is 
something like this:

Whenever one Toggle button is clicked, it raises the click event, there 
(inside the event function) I unpress all others by hand.

The problem is that when I unpress them it calls for the same click 
event function, causing a "recursion limit" error. Any ideas?

  
  
It sounds like you want the behavior of RadioButtons instead of just
ToggleButtons.
  

Yes, exactly. Also if anyone can explain how I can also avoid the
recursion problem when calling for events within event function, that
would also be nice.


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/