Behaviors – enhancing widget's functionality

Behaviors were introduced recently in the Kivy version 1.8.0, and allow us to increase the functionality and flexibility of the existing widgets. Basically, they let us inject classic behaviors of certain widgets into other behaviors. For example, we can use ButtonBehavior in order to add the on_press and on_release functionality to a Label or Image widget. Currently, there are three types of behavior (ButtonBehavior, ToggleButtonBehavior, and DragBehavior) and more will be coming in the next Kivy releases.

Let's add some credits to our application. We want to add some functionality to the Status Bar so that when we click, a Popup will appear and show some text. First, we will import the necessary ...

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.