Book Image

Kivy Cookbook

By : Hugo Solis
Book Image

Kivy Cookbook

By: Hugo Solis

Overview of this book

Table of Contents (16 chapters)
Kivy Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Carousel


The Carousel widget is an advanced way to present pictures, which is already present in modern apps. This is because it permits to display a large number of pictures in a helpful way for when the user wants to search for a particular one. In this recipe, we will create an app with the Carousel widget where the user will navigate between three pictures. They will look like the following:

If you drag the image to the right, you will see this next image:

Getting ready

In order to start this recipe, it is necessary to have three different pictures in standard formats (that is, PNG or JPEG). We have to rename them as f0.png, f1.png, and f2.png, or with the .jpg extension if it is appropriate.

How to do it…

To complete this recipe, we will use just a Python file where we will call the Carousel widget and set it up to display our pictures. Follow these steps:

  1. Import the usual kivy packages.

  2. Import the Factory package.

  3. Import the Carousel widget.

  4. Define the root widget class.

  5. In the __init__...