How to disable a widget in Kivy?

Ulrich Von Rekkenin picture Ulrich Von Rekkenin · Nov 7, 2013 · Viewed 17.5k times · Source

I read the Kivy tutorial and couldn't find how to disable a widget (for example, a Button).

def foo(self, instance, *args):
  #... main business logic, and then
  instance.disable = False
  # type(instance) = kivy.uix.Button

I bind foo with functools.partial.

What is the correct parameter?

Answer

qua-non picture qua-non · Nov 7, 2013

If you are using kivy version >= 1.8 then you can just do widget.disabled = True. If on previous versions you can simply manage the disabling yourself, just make sure it doesn't react to touch and displays a alternative look when disabled.