How do I give focus to a python Tkinter text widget? How do I give focus to a python Tkinter text widget? tkinter tkinter

How do I give focus to a python Tkinter text widget?


You use the focus_set method. For example:

from Tkinter import *root = Tk()Window = Frame(root)TextWidget = Text(Window)TextWidget.pack()Window.pack()TextWidget.focus_set()root.mainloop()