News for hackers. Stuff that matters.
Re:Show HN: A modular Python TUI framework with a fast and p... by bczsalba on Wednesday March 02, 2022 @02:22AM (#30524718)
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.
Re:Show HN: A modular Python TUI framework with a fast and p... by inshadows on Wednesday March 02, 2022 @04:29PM (#30533444)
Perfect! 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.
Re:Show HN: A modular Python TUI framework with a fast and p... by bczsalba on Friday March 04, 2022 @06:30AM (#30553318)
So 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!

Re:Show HN: A modular Python TUI framework with a fast and p... by bczsalba on Thursday March 03, 2022 @01:40AM (#30537886)
Alright, I'll keep that in mind! Thank you for the suggestion :D
Re:Show HN: A modular Python TUI framework with a fast and p... by kleer001 on Thursday March 03, 2022 @12:57PM (#30544302)
That sounds really nice!