Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Shortcut for numeric keys not working with addMenuItem #298
I tried to create menu items with the shortcut Control-1 and Control-2. Pressing Ctrl+1 neither calls the specified function produces nor produces any error message. Same result for Alt-, Alt-Control-, or Shift-Control- for any of the numeric keys 1-9.
Have done a bit of digging, and found this:
appJar creates a binding, such as: <Control-1>or <Shift-Control-1>. Accoring to SO, this actually binds the mouse buttons!?!
So, I will need to add in a check to see if it's a number, and if it is, create a slightly different binding: <Control-Key-1> or <Shift-Control-Key-1>
added a commit
Nov 23, 2017
This is resolved (for numeric shortcuts) in the next release.
There was no error, because a shortcut was being created - it was just linking to the mouse button, instead of the number key.
I imagine similar issues exist with special characters - if there's no error, a binding is getting created, just maybe not the one we're expecting...
Now, you mentioned it, I remember having had exactly the same issue a couple of month ago while trying to learn using tkinter directly ...
Yeah, this is all a bit of a hangover from when I initially introduced the feature.
I tried to make it as bomb proof as possible, so that it was cross-platform and could deal with most of what you threw at it.
Combine that, with the fact that on MAC - all apps display the shortcut in upper case, and I think it does break things a little.
I will look into refactoring the shortcuts for the 1.0 release, and raise that as a new request.