
Kivy Cookbook
By :

A one-time event is one of those clock-related events where you perform an event just once after some time has passed.
In this recipe, it is assumed that the reader is acquainted with the Kv language and widgets, especially with labels. Also, we will implement the concept of using a mouse to perform the actions that we learned in Chapter 2, Input, Motion, and Touch, particularly for this recipe, using the mouse to perform the actions.
To complete this recipe, follow these steps:
First, in the KV file, let's declare an empty label. You can do this by using the following code:
<MyW>: Label: id: label1 pos: 200,200 text: ''
Then in the Python code, import the Clock
object instance.
In the widget class, define the method my_callback()
, which will be fired.
Also, override the on_touch_down()
method where we will schedule the event, using the following code:
import kivy from kivy.app import App from kivy.uix.widget...
Change the font size
Change margin width
Change background colour