开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜