pygame-menu
pygame-menu copied to clipboard
[FEAT] Button active state
Is your feature request related to a problem? Please describe. I need an ability to disable a button:
- it gets more dark
- it even is not selectable So this can be called as inactive button It stays so unless you enable it!
Describe the solution you'd like
A clear and concise description of what you want to happen.
Add methods to enable/disable button
Also add this as disabled: bool
consturctor parameter!
Describe alternatives you've considered No good
Additional context This project is actually a really good thing in my life! :-)
Check out also the readonly
widget property:
button = menu.add.button(...)
button.readonly = True
Readonly ignores all events of widgets (it should...). This can also be another solution. Then you can apply a different background color for buttons. If you plan to combine these two solutions it would be great =)
Greetings!
Great. It works! =)
Btw, how to change the color of text when the widget is readonly?
Hello, sorry for the delay... hope you've already solved this issue.
For any upcoming person with this same problem: You can use the Theme.readonly_color
and readonly_selected_color
attributes. Also, you can manually set set_background_color()
depending on the read-only status.