O'Reilly logo

Kivy – Interactive Applications and Games in Python - Second Edition by Roberto Ulloa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating your own events – the magical properties

This section covers the use of the Kivy properties. A Kivy property triggers an event every time we modify it. There are different types of properties, from the simple NumericProperty or StringProperty to much more complex versions such as ListProperty, DictProperty, or ObjectProperty. For example, if we define a StringProperty called text, then an on_text event is going to be triggered each time the text is modified.

Note

Once we define a Kivy property, Kivy internally creates an event associated with that property. The property event is referenced adding the prefix on_ to the name of the property. For example, the on_translation method (line 246) is associated with ListProperty in line 219 called ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required