[pygtk] make button insenstive when the contents of gtk.Entry
have changed
Thomas Mills Hinkle
tmhinkle at gmail.com
Tue Nov 14 19:09:53 WST 2006
On 11/14/06, John Kelly <kelly_worth2003 at yahoo.co.uk> 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'm confused -- have you tried simply using the 'changed' signal on the
Entry?
Here's some quick code that seems to do what you want:
import gtk
e =3D gtk.Entry()
b =3D gtk.Button('Test Button')
b.set_sensitive(False)
def entry_changed_cb (entry):
text =3D entry.get_text()
if text: b.set_sensitive(True)
else: b.set_sensitive(False)
e.connect('changed',entry_changed_cb)
w =3D gtk.Window()
vb =3D gtk.VBox()
vb.add(e); vb.add(b)
w.add(vb)
w.show_all()
w.connect('delete-event',gtk.main_quit)
gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061114/53bcc7a5/at=
tachment.htm
More information about the pygtk
mailing list