pygame-menu icon indicating copy to clipboard operation
pygame-menu copied to clipboard

[FEAT] Button active state

Open leestarb opened this issue 2 years ago • 3 comments

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! :-)

leestarb avatar Aug 05 '22 11:08 leestarb

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!

ppizarror avatar Aug 08 '22 05:08 ppizarror

Great. It works! =)

leestarb avatar Aug 10 '22 12:08 leestarb

Btw, how to change the color of text when the widget is readonly?

leestarb avatar Aug 10 '22 12:08 leestarb

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.

ppizarror avatar Dec 22 '22 18:12 ppizarror