How to set background color for disabled buttons seperate from enabled buttons

1,384 views
Skip to first unread message

Peter Bouda

unread,
Jul 21, 2014, 10:24:52 AM7/21/14
to kivy-...@googlegroups.com
Hi,

I derive my own button class from Button, and want that disabled buttons are black, while all others are displayed normally. When I start:

class BoardTile(Button):

    background_disabled_normal = None

Then the background of disabled buttons are white. If I add:

class BoardTile(Button):

    background_disabled_normal = None
    background_color = ListProperty([0, 0, 0, 1])

Then also my enabled buttons have a black background, without the background image. I couldn't find out why this is the case, as the background image should be painted normally...? I also tried to set "disabled_color" (defined in Label) without luck.

How do I set disabled buttons to just black color while the enabled button show the standard image/background?

Peter

Alexander Taylor

unread,
Jul 22, 2014, 8:12:19 AM7/22/14
to kivy-...@googlegroups.com
Option 1) Change the background_color when the button is disabled. This acts as a multiple on the background image, so (0, 0, 0, 1) will always be black, and (1, 1, 1, 1) will show the normal image.

Option 2) Make the disabled background image something black, e.g. just a few black pixels.
Reply all
Reply to author
Forward
0 new messages