> For the complete documentation index, see [llms.txt](https://docs.kivy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kivy.fun/getting-started/events.md).

# Events

Kivy is mostly [event-based](http://en.wikipedia.org/wiki/Event-driven_programming), meaning the flow of the program is determined by events.

**Clock events**

The `/api-kivy.clock` allows you to schedule a function call in the future as a one-time event with `~kivy.clock.ClockBase.schedule_once`, or as a repetitive event with `~kivy.clock.ClockBase.schedule_interval`.

You can also create Triggered events with `~kivy.clock.ClockBase.create_trigger`. Triggers have the advantage of being called only once per frame, even if you have scheduled multiple triggers for the same callback.

**Input events**

All the mouse click, touch and scroll wheel events are part of the `~kivy.input.motionevent.MotionEvent`, extended by `/api-kivy.input.postproc` and dispatched through the `~kivy.core.window.WindowBase.on_motion` event in the `Window <kivy.core.window.WindowBase>` class. This event then generates the `~kivy.uix.widget.Widget.on_touch_down`, `~kivy.uix.widget.Widget.on_touch_move` and `~kivy.uix.widget.Widget.on_touch_up` events in the `~kivy.uix.widget.Widget`.

For an in-depth explanation, have a look at `/api-kivy.input`.

**Class events**

Our base class `~kivy.event.EventDispatcher`, used by `~kivy.uix.widget.Widget`, uses the power of our `/api-kivy.properties` for dispatching changes. This means when a widget changes its position or size, the corresponding event is automatically fired.

In addition, you have the ability to create your own events using `~kivy.event.EventDispatcher.register_event_type`, as the on\_press and on\_release events in the `~kivy.uix.button.Button` widget demonstrate.

Another thing to note is that if you override an event, you become responsible for implementing all its behaviour previously handled by the base class. The easiest way to do this is to call \`super()\`:

```
def on_touch_down(self, touch):
    if super(OurClassName, self).on_touch_down(touch):
        return True
    if not self.collide_point(touch.x, touch.y):
        return False
    print('you touched me!')
    return True
```

Get more familiar with events by reading the `/guide/events` documentation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kivy.fun/getting-started/events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
