Overriding default tab behaviour in Python Tkinter
I am writing an application in Python using Tkinter to manage my GUI.
There is a text entry box on which I am trying to implement an autocompletion function which will bind to the Tab key.
I have bound the tab key to my entry box, but when I pr开发者_JS百科ess tab, the program attempts to cycle between GUI elements.
How do I override this default behavior so that the GUI will only carry out my specified command on the key press?
Return 'break'
at the end of your event handler. It interrupts event propagation.
def my_tab_handler(event):
... # handle tab event
return 'break' # interrupts event propagation to default handlers
精彩评论