Triggering events

If we want to schedule the events, we can trigger them, which will help you trigger the same event in different parts of your code. In the next described recipe, the event will be triggered when we double tap.

Getting ready

Again, we are going to make use of the double tap, so it is important that you refer to the recipes in Chapter 2, Input, Motion, and Touch. Even though the skeleton of the code is similar to that for the last event, the actions are completely different. Here the unscheduling will be automatic.

How to do it…

Perform the following steps to achieve the goal:

  1. First, in the KV file, declare an empty label using the following code:
    <MyW>:
        Label:
            id: label1
            pos: 200,200
            text: ''
  2. In the Python code, import the Clock object ...

Get Kivy Cookbook 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.