Key commands in Tkinter
I made a GUI wit开发者_如何转开发h Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command.
Example:
Say I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then run on my program.
Tkinter, on its own, cannot grab keystrokes that (from the OS's/WM's viewpoint) were directed to other, unrelated windows -- you'll need to instruct your window manager, desktop manager, or "operating system", to direct certain keystrokes differently than it usually does. So, what platform do you need to support for this functionality? Each platform has different ways to perform this kind of functionality, of course.
精彩评论