Binding events in the Kivy language
So far, we have been handling events in two ways: overridding an event method (for example, on_touch_event
) and binding a personalize method to a related event method (for example, ds.bind(on_touch_move=self.update_figure)
). In this section, we will discuss a different way, that is, binding events in the Kivy language. Potentially, we could have done this since the beginning of this chapter when we started working with DraggableWidget
but there is a difference. If we use the Kivy language, we can easily add the event to a specific instance and not to all the instances of the same class. In this sense, it resembles dinamically binding an instance to its callback with the bind
method.
We are going to concentrate ...
Get Kivy – Interactive Applications and Games in Python - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.