Using the mouse

This recipe will teach you how to use the first kind of input, probably the most used, the mouse. We will consider the mouse input as a touch event, so the (x, y) position of the touch (0-1 range) will be scaled to the window size (width/height) and dispatched to the following:

  • on_touch_down: An event is fired when a touch down event is initiated. Subsequently, the respective widget's on_touch_down() method is called.
  • on_touch_move: An event is fired when a touch event moves (changes location). Subsequently, the respective widget's on_touch_move() method is called.
  • on_touch_up: An event is fired when a down event is released (terminated). Subsequently, the respective widget's on_touch_up() method is called.

Getting ready

In this recipe, ...

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.