Guides Garden API Reference PDF Wiki
Version
Getting Started » Events
stable
Kivy is mostly event-based, meaning the flow of the program is determined by events.
Quick search
Clock events
Go The Clock object allows you to schedule a function call in the future as a one-time event with schedule_once() , or as a repetitive event
with schedule_interval() .
Gallery of Examples
You can also create Triggered events with create_trigger() . Triggers have the advantage of being called only once per frame, even if you have
Getting Started scheduled multiple triggers for the same callback.
Introduction Input events
Installing Kivy All the mouse click, touch and scroll wheel events are part of the MotionEvent , extended by Input Postprocessing and dispatched through
the on_motion event in the Window class. This event then generates the on_touch_down() , on_touch_move() and on_touch_up()
A first App events in the Widget .
Properties For an in-depth explanation, have a look at Input management.
Kv Design Language Class events
Events Our base class EventDispatcher , used by Widget , uses the power of our Properties for dispatching changes. This means when a widget
changes its position or size, the corresponding event is automatically fired.
Non-widget stuff
In addition, you have the ability to create your own events using register_event_type() , as the on_press and on_release events in the
Layouts
Button widget demonstrate.
Drawing
Another thing to note is that if you override an event, you become responsible for implementing all its behaviour previously handled by the base
Packaging class. The easiest way to do this is to call super():
Diving in
def on_touch_down(self, touch):
if super().on_touch_down(touch):
Kivy Project
return True
if not self.collide_point(touch.x, touch.y):
Programming Guide return False
print('you touched me!')
Tutorials return True
Get more familiar with events by reading the Events and Properties documentation.
« Kv Design Language Non-widget stuff »