-
Notifications
You must be signed in to change notification settings - Fork 68
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complex Keybinds #499
Comments
Python 3.6.6 |
Just had a play with this, with the following code: from appJar import gui
def keyPress(key): print(key, 'pressed')
with gui() as app:
app.label('hello world')
app.addMenuItem('a', 'a', shortcut='Control-Key-1', func=keyPress)
app.addMenuItem('a', 'b', shortcut='Control-Key-2', func=keyPress)
app.addMenuItem('a', 'c', shortcut='Control-Shift-T', func=keyPress) When I run the code in
And, when I test it, it seems to work: |
A couple of things to point out here though:
|
Thanks for confirmation, I'll have to run using the -t flag and see what I come up with! |
Sorry for the delay. I've come back to this issue and it doesn't seem to be resolved. 'Control-Shift-H' is not responding. Luckily, 'Control-H' isn't activated when I try the former keystroke, but it would be nice if this complex keybind worked. I'll be back with a -t-flag stacktrace. |
Stripped out most of the code trying to format shortcuts/bindings for menus
@robertmlinden - I've done a fair bit of digging into this today, and safe to say, it's all a bit of a mess. The default behaviour in tkinter is that keyboard bindings are case-sensitive, so the binding This is different to how menus work in other applications. They seem to be case-insensitive, and will NOT match in the second example, where holding This is consistent across both Mac & Windows when creating bindings. I think the case-insensitivity can be dealt with: by registering two bindings each time. There is another level of complexity with menu bindings, as the shortcut text also needs to be generated and added to the menu. The chevrons need to be removed, words like Furthermore, it seems that adding shortcuts to Mac menus, creates the bindings - and case insensitive ones at that! Which is not what the docs say should happen! For now, I'm going to strip out all the extra code I put in for registering menu shortcuts, and just have it do exactly what the user requests, and then start adding it back in from there. |
Thank you, I'll work with simple keybinds for now! |
Also, added table properties #517
OK - I've tested this on windows/Mac/Pi and it works consistently how I want it across all platforms. There are two areas that might not be ideal:
|
NB. None of this has been done to the |
Menu keybinds such as 'Control-Shift-R' are unresponsive.
IBM Developer Thinkpad
0.93.0
The text was updated successfully, but these errors were encountered: