Disabled property on kivy 1.10.1

363 views
Skip to first unread message

Damian Korbuszewski

unread,
Jul 15, 2018, 12:34:04 PM7/15/18
to Kivy users support
I little confused with disabled property after updating kivy to 1.10.1

Up to now i used syntax like with slider widget, but currently it fails to disable "properly" some widgets. With slider i get disabled look, but all events from it are not suppresed. Blocking widget from methods don't work as expected too.
Is it possible currently to disable widget when creating it within python? Or i must to disabled it now after adding to parent widget like with button.

from kivy.uix.button import Button
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.slider import Slider

from kivy.app import App

class MainApp(App):
def build(self):
self.layout = BoxLayout()
self.button = Button(text='Simple Button')
self.slider = Slider(disabled=True)
self.slider.bind(value=self.on_value)
self.tbutton = ToggleButton(text='Disable slider', state='down')
self.tbutton.bind(state=self.on_state)
self.layout.add_widget(self.button)
self.layout.add_widget(self.slider)
self.layout.add_widget(self.tbutton)
self.button.disabled = True
#self.slider.disabled = True
return self.layout
def on_value(self, instance, value):
self.button.text = str(value)
def on_state(self, instance, state):
if state == 'down':
self.slider.disabled = True
self.button.disabled = True
else:
self.slider.disabled = False
self.button.disabled = False
if __name__ == '__main__':
MainApp().run()


Alexander Taylor

unread,
Jul 15, 2018, 7:32:26 PM7/15/18
to Kivy users support
I believe there were some internal changes to the disabled property for this release, but this shouldn't have affected the visible behaviour in most circumstances. Would you be able to open an issue on the github page about it? I think we'll hopefully try to address these bugs with another minor release sooner rather than later.

ZenCODE

unread,
Jul 16, 2018, 3:18:00 PM7/16/18
to Kivy users support
So, from the docs:

    disabled: Indicates whether this widget can interact with input or not.

That implies it's only the interaction events that is suppressed, not others. Which seems logical enough? Your example (thanks for preparing a minimal one) works exactly as I would expect, so when you say "not as expected too", what exactly are you expecting?

Once we know exactly what you are expecting, we can look at what the proper behavior "should" be and then decide whether it's an issue or not. It has changed in 1.10.1, but I think for the better.

    Changed in version 1.10.1: disabled was changed from a BooleanProperty to an AliasProperty to allow access to its previous state when a parent’s disabled state is changed.

Tyler

unread,
Sep 4, 2018, 3:45:15 PM9/4/18
to Kivy users support
Hi, I've just stumbled upon a problem with disabled widget property when using Kivy 1.10.1 so looked here and ran OP code and it seems to be related.

What happens is that when running OP's example in 1.10.0, both "left generic button" and slider get disabled when toggling the "right toggle button".
When the toggle button is on (highlighted blue) both the left button and the slider are disabled, can't be interacted with by using the mouse or dragging the slider and have their disabled property set to True, also they visually appear to be "dimmed" or "grayed out" as to indicate that they're in fact disabled.

The opposite works as well, when button is toggled off, slider and left button are not dimmed they look interactive and can be clicked / used, their disabled property gets changed to False.

On the other hand running the code on 1.10.1 makes the toggle button toggle only the disabled property of the "left generic button", while the slider is always enabled and can be interacted with, no matter if the toggle is set on or off. But visually "left generic button" always looks as if it's not disabled even when it is, so the button label never gets "dimmed" or grayed out, it's always white. In case of the slider, it always looks "dimmed" as if it's disabled, but can always be interacted with and the disabled property itself doesn't change with the toggles, it's always False.

In my app something similar happens, there's a line in .kv file where:

<MyButton>:    disabled: not self.unlocked

and while it works in 1.10 (it's set to True/False according to the unlocked property) it's always False in 1.10.1 even when I set it to disabled: True

It looks to me that behavior between Kivy versions is inconsistent and there might be a bug, I hope this illustrates the unexpected behavior the OP was talking about.

Best regards

Damian Korbuszewski

unread,
Sep 4, 2018, 3:49:48 PM9/4/18
to Kivy users support
https://github.com/kivy/kivy/issues/5861 it it fixed in nightly version. And should be in 1.10.2 or 1.11 version

Tyler

unread,
Sep 5, 2018, 4:09:00 AM9/5/18
to Kivy users support
That's excellent news, thank you!

On Tuesday, September 4, 2018 at 9:49:48 PM UTC+2, Damian Korbuszewski wrote:
https://github.com/kivy/kivy/ issues / 5861 it it fixed in nightly version. And should be in version 1.11 or 1.10.2
Reply all
Reply to author
Forward
0 new messages