Background color of disabled Spinner
<p>I'm trying to set the background color of the Spinner, if disabled.</p>

<p>Here is what I tried in my kv-file:</p>

<pre><code>&lt;MySpinner@Spinner&gt;:
    background_normal: ''
    background_disabled_normal: ''
    disabled_color: (0, 0, 0, 1)
    color: (0, 0, 0, 1)
    background_disabled_color: (1,1,1,1)
    background_color: (0.62,0.67,0.72,1)
</code></pre>

<p>Obviously the  <code>background_disabled_color</code> is not the right parameter. But what should I use instead?</p>

<p>It inherits from <code>Button</code>, therefore if it's not in the <code>spinner.py</code> file, it'll be in <a href="https://github.com/kivy/kivy/blob/master/kivy/uix/button.py#L90" rel="nofollow"><code>button.py</code></a></p>

<p>You can see that <code>Button</code> uses images for the background and with <code>background_color</code> it's only tinted, yet there's no <code>background_disabled_color</code> (afaik). The background works like this - you set <code>background_color</code> and if the widget is disabled, it tints the default background image for disabled (which is little bit <a href="https://github.com/kivy/kivy/blob/master/kivy/data/images/defaulttheme-0.png" rel="nofollow">darker</a>):</p>

<pre><code>Button:
    text: 'jump'
    disabled: True
    # background_disabled_normal: ''  # allow to see the behavior w/o default disabled bg
    background_color: (1,0,0,1)
</code></pre>

<p>To achieve another color for disabled widget than the default <code>background_color</code> you need to change the <code>background_color</code> when the <code>Button</code> is disabled (in your case <code>Spinner</code>):</p>

<pre><code>from kivy.lang import Builder
from kivy.base import runTouchApp
from kivy.uix.boxlayout import BoxLayout
Builder.load_string('''
&lt;Test&gt;:
    Spinner:
        id: special
        values: [str(i) for i in range(10)]
        size_hint_y: None
        text: 'jump'
        disabled: True
        #background_disabled_normal: ''
        background_color: (1,0,0,1) if not self.disabled else (0,1,0,1)
    Button:
        on_release: special.disabled = not special.disabled
''')
class Test(BoxLayout): pass
runTouchApp(Test())
</code></pre>

<p>Note that this won't work for the <code>DropDown</code>-like children, because those use <a href="https://github.com/kivy/kivy/blob/master/kivy/uix/spinner.py#L48" rel="nofollow">different</a> class, so to change them you'll need to change properties of that class.</p>

python kivy