BoundedNumericProperty
, in fact any Property
, can have an errorhandler
at creation to deal with invalid values:
class MyCl(EventDispatcher):
# returns the boundary value when exceeded
bnp = BoundedNumericProperty(0, min=-500, max=500,
errorhandler=lambda x: 500 if x > 500 else -500)
I tried to change the errorhandler property at runtime, in a method of MyCl
:
def set_err(self, new_err):
self.property('bnp').errorhandler = lambda x: new_err
but to my surprise, I get
AttributeError: "'kivy.properties.BoundedNumericProperty' object has no attribute 'errorhandler'"
So, how do I change the errorhandler after creation of the property?