Closed samhaaf closed 2 years ago
Yup, that code is very weird. Probably had some reason behind it when it was written, but not sure what it does now. For what it's worth it is still selectable using the button, but that's not helping much.
Thank you for the really detailed issue btw, I'll get on fixing it as soon as I have time.
Turns out I could use your exact code to fix the issue, so thank you for that. There is no initial selection at the moment for various (mostly legacy at this point) reasons, but now that you mention it there probably should be.
Thank you for the issue!
Thank you for this project! It's a perfect abstraction, and I'm going to use it a lot
I'd love to see what you come up with! It's lovely to see people enjoying the library.
Describe the bug When you create a container (only tested on the Window widget) with only one button in it, you can't select the button.
To Reproduce
Expected behavior I would expect there to be either:
System information
Possible cause Here, only selecting when selectables_length is 2 or more:
/pytermgui/widgets/layouts.py
Possible solution
Updating to
>= 1
would handle this single selectable case, and returning True after the first select will trigger the style update on the button to its 'highlight' class./pytermgui/widgets/layouts.py