Recording gestures

A gesture is a particular succession of touches, which we will give some special significance to. Kivy eases the way to handle gestures.

Getting ready

In this recipe, we will use some predefined graphics in the Kivy framework just to highlight the gesture, and you do not need any further knowledge about it. Also, we have a predefined gesture that is provided in this recipe to you.

How to do it…

In this recipe, we have the next steps:

  1. Call the gesture database.
  2. Make a method to categorize the gesture.
  3. Set a marker for the initial touch.
  4. Record the touch.
  5. Do the comparison with the predefined gesture.
  6. Print the result:
    from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.graphics import ...

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.