问题
How can I make a widget that will not get the focus ever in tkinter? For example, a button that when I will press TAB the focus will skip on him
回答1:
I have found some time to provide a working example:
import Tkinter
import tkMessageBox
root = Tkinter.Tk()
but1 = Tkinter.Button(root, text ="Button 1")
but1.pack()
butNoFocus = Tkinter.Button(root, text ="Button no focus", takefocus = 0)
butNoFocus.pack()
but2 = Tkinter.Button(root, text = "Button 2")
but2.pack()
root.mainloop()
takefocus
option set to 0 will disable tab focus on created button.
来源:https://stackoverflow.com/questions/39703766/disable-focus-for-tkinter-widgets