-
Notifications
You must be signed in to change notification settings - Fork 116
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
feature request: hotkeys for buttons in buttonbox #16
Comments
Ah, I originally misunderstood. I thought you meant "first character", but now I see, so perhaps a button would have the text "eXit" and then 'X' is the hotkey. Is that correct? Are there cases where the user wants a different keystroke, so maybe for buttons left, right, up, down, they want a, d, w, s ? How about set priority: Also, if we use '&', then I suggest & should be used to insert an & without assigning a hotkey. |
there is the (rare) case that you want the hotkey not to be visible on the button itself (think of translation or many buttons with nearly identical names). Other example would be to have a button with the string "left" but hotkey should be "cursor left key". would be cool to give ascii code or some other code as hotkey parameter (optional) |
I just checked in a change that allows key bindings. One thing to check is if the return is proper. For instance, if a button is named '&Yes', it returns '&Yes' and not 'Yes'. For a literal &, use a double like: && Also modified things such that cancel (Escape, the big red X) will always close a dialog and return None. Limitation: Can't bind control keys such as arrows Enter, etc to a button. |
Horst, I didn't address your request to handle control keys. there also is no way to hide the character. If you have ideas for syntax, I'd appreciate it. |
would it be possible to take the first characther in square brackets as hotkey ? ( like "press this [B]utton" --> B ) as this is how i normally indicate the button to be pressed in a visible text string. |
It should be easy to switch it over. I'll give it a try. |
I updated the code and committed it. Now, you can say [B]utton which will display the B also, or say [[B]]utton, which will hide the B. Or, you can assign a keysym like [] which will bind F1 to that button. One big question: When we return the button pressed, do we include the [, ], etc or not? |
as far as i understand easygui always returns the full text string of the clicked (hotkeyed) button. I vote for including all the square brackets, as it make sense that you get returned the same string that you wrote as parameter. |
so that a press of a key is like the button was cklicked with the mouse.
i suggest using the first Uppercase Char in a button string as hotkey
The text was updated successfully, but these errors were encountered: