Scheduling a repetitive event
After our first recipe, we can think about how to schedule a repetitive event. The present recipe will use one touch in the app to schedule the event and a double touch to unschedule the event.
Getting ready
We will use the knowledge about inputs from Chapter 2, Input, Motion, and Touch, particularly for this recipe, and will use multitouching to perform our actions. Also, it is useful to know that the label is a basic widget in the Kv language.
How to do it…
To complete this recipe, perform the following listed steps:
First, in the KV file, declare an empty label. The following code will help you do this:
<MyW>: Label: id: label1 pos: 200,200 text: ''
In the Python code, import the
Clock
object instance.In the
widget
class, define the methodmy_callback()
, which is the method that will be fired.Also, override the method
on_touch_down()
where we can schedule the repetitive event.With an
if
statement, select a double tap and unschedule...