You should try connecting to the notify::property signal, which gets
emitted when the given property changes. A quick example:
import gtk
# gets called whenever the text changes
def text_changed(entry, prop):
if entry.props.text == '':
button.set_sensitive(False)
else:
button.set_sensitive(True)
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
vbox = gtk.VBox(False, False)
entry = gtk.Entry()
button = gtk.Button(stock='gtk-ok')
# initially insensitive
button.set_sensitive(False)
# connect the signal to whenever the text changes
entry.connect('notify::text', text_changed)
vbox.pack_start(entry, False, True)
vbox.pack_start(button, True, True)
window.add(vbox)
window.show_all()
gtk.main()
Samuel Cormier-Iijima
On 11/14/06, John Kelly <[EMAIL PROTECTED]> wrote:
Hello everyone,
I need some help in making a gtk.Button insensitive when a gtk.Entry
contents have changed. I have tried many different signals, each of them
failed to do what i wanted. I basically want the exact same behaviour as
gaim's add account dialog. In the add account dialog, if the screen name
entry has no characters in it then the save button remains insensitive.
The save button appears active when characters are entered in the
screenname entry.
Regards,
John
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The
Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/