Kivy — it is a platform independent GUI tool in Python. Since it can be run on Android, IOS, Linux, Windows, etc. It is mainly used to develop Android application, but that does not mean it cannot be used in desktop applications.
Carousel widgets:
The Carousel widget provides a classic mobile-friendly carousel look where you can navigate between slides. You can add any content to the carousel and make it move horizontally or vertically. The carousel can display pages in sequence or in a loop.
To work with this widget, you need to import:
from kivy.uix.carousel import Carousel
Basic Approach: 1) import kivy 2) import kivy App 3) import Gridlayout 4) import Carousel 5) set minimum version (optional) 6) Create as much as widget class as needed 7) create the App class 8) return the widget / layout etc class 9) Create Carousel.kv file: 1) Create button (or what is needed) 2) Arrange the on_release / on_press function 10) Run an instance of the class
In the below In the example we create buttons in the application. In this we used the functions load_previous ()
and load_next ()
.
load_next (mode = ’next’)
Animate to the next slide.load_previous ()
Animate to the previous slide.
Implementation of the approach:
file main.py:
|
File Corousel.kv :
< / p> |
Output: