Using the gyroscope

Mobile devices today also have a gyroscope. The gyroscope is considered as a no-touch event. This kind of event does not have a start or an end; it is always providing information.

Getting ready

For this recipe, we will use the Kv language for the design of the widgets. Also, this recipe will use the common button and label widgets for reference. Obviously, to run the code of this recipe properly, a device with a gyroscope is necessary.

It is necessary to install a package to use the gyroscope with any mobile device. While there is a way to deal with specific devices, we do not have to reinvent the wheel. Let's use the plyer package, which is an effort from many of the Kivy developers. To install the package from the shell, use: ...

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.