[Tutor] Focus in tkinter

Michael Lange klappnase at freenet.de
Wed Sep 14 21:54:06 CEST 2005


On Wed, 14 Sep 2005 19:58:07 +0100 (BST)
David Holland <davholla2002 at yahoo.co.uk> wrote:

> I want to make the mouse focus in a GUI move to the
> correct button/text entry widget.  Does anyone know
> how to do this ?
> 

Hi David,

to set the focus to a particular widget you need the focus_Set() method:

b = Button(parent)
b.focus_set()

Maybe you want to have a look at Frederik Lundh's excellent Tkinter books:

   <http://www.effbot.org/tkinterbook>

or the more complete, but a little outdated version:

    <http://www.pythonware.com/library/tkinter/introduction/index.htm>

I hope this helps

Michael


More information about the Tutor mailing list