[pygtk] gtk.set_state question. Change button state

rudsonalves at yahoo.com.br rudsonalves at yahoo.com.br
Mon Jun 16 10:42:54 WST 2008


Hi group,

I desable a button with button.set_state(gtk.STATE_INSENSITIVE) in one
procedure. In other I need enable it, but a simple
button.set_state(gtk.STATE_NORMAL), not enable it.

How I can make it?

Program sample:
def b1_callback(widget, data = None):
    print 'button1 is clicked. Disable button 1.'
    widget.set_state(gtk.STATE_INSENSITIVE)

def b2_callback(widget, button):
    print 'button 2 is clicked. Enable button 1.'
    button.set_state(gtk.STATE_NORMAL)

class test:
...
    button1 = gtk.Button('Button 1')
    button2 = gtk.Button('Button 2')
    button1.connect('clicked', b1_callback)
    button2.connect('clicked', b2_callback)
...

Thanks,
Rudson Alves






More information about the pygtk mailing list