[pygtk] Fwd: Re: Setting focus to a textEntry
Olaf Devik
olaf.devik at mollefaret.no
Fri Sep 30 00:38:37 WST 2011
The critical line was:
b.connect('clicked', lambda w: e.grab_focus())
I entered the button, the textEntry and the main already defined, now
the cursor shows up in the right place. Apparently I had misunderstood
the grab_focus.
Thanks for assistance and help.
Regards
Olaf Devik
e-mail: olaf.devik at mollefaret.no
mobile: +47 911 70 849
-------- Opprinnelig melding --------
Emne: Re: [pygtk] Setting focus to a textEntry
Dato: Thu, 29 Sep 2011 17:11:47 +0200
Fra: towb at celvina.de
Til: olaf.devik at mollefaret.no
CC: pygtk at daa.com.au
On 29.09.2011, at 13:56, Olaf Devik wrote:
> I have tried grab_focus and have verified by checking which widget has focus. But I can not see that this is happening in the window and using TAB, apparently the active widget still is the save button.
What exactly are you doing? A later signal handler might revert the effects of your call. However this works for me:
import gtk
e = gtk.Entry()
b = gtk.Button("Save")
b.connect('clicked', lambda w: e.grab_focus())
c = gtk.VBox()
c.pack_start(e)
c.pack_end(b)
w = gtk.Window()
w.add(c)
w.connect('delete-event', gtk.main_quit)
w.show_all()
gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20110929/c62f6daa/attachment.html>
More information about the pygtk
mailing list