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.de...@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: t...@celvina.de Til: olaf.de...@mollefaret.no CC: pygtk@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()
_______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/