3 ms·
After thinking about it overnight, I'm thinking about adding a button type that automatically binds its onclick method to either a given or automatically genera
by bczsalba 5y ago
After thinking about it overnight, I'm thinking about adding a button type that automatically binds its onclick method to either a given or automatically generated binding.
So something like
ptg.KeyboardButton("Help")
or
ptg.KeyboardButton("Action", binding=ptg.keys.CTRL_B)
These would create a button with a label such as "[H]elp" and "[B] Action", and pressing `CTRL_` + their button would activate them. If idea is fine implementation should really not take much time.
- kleer001 5y agoThat sounds really nice!
- inshadows 5y agoPerfect! Usually mnemonics are activated by Meta-$letter, e.g. Meta-C (or Alt-C) for "[C]ancel" or Meta-M for "I[m]port". That has long tradition. I've just found the I[m]port example in Evolution's (mail client) [F]ile menu. It also works that way in console twin-panel file managers Midnight Commander and almost all menu-like GUI panels in Windows applications.
- bczsalba 5y agoSo I'm midway through implmementing it all, and I'm finding that a lot of both meta and alt keys have behaviours that block them from working on my Mac. I know on Linux it probably isn't like that, but a lot of people will have Meta- bindings for some actions in the UI. Would it be a huge issue if it defaulted to CTRL? ATM I'm having issues even recording the value of my meta keypresses as too many of them are default bindings in MacOS. Edit: Regardless, it is now pushed on GH. Will be included in next version, thank you both for the suggestion!
- bczsalba 5y agoAlright, I'll keep that in mind! Thank you for the suggestion :D