- Kivy provides a Carousel widget, which enables traversing through a set of slides.
- The slides in a Carousel could be images, videos or any other contents.
- The contents of the Carousel can be either moved horizontally or vertically through swipes.
- Carousel is a powerful way of representing an image gallery, video gallery, news articles and the like.
- Carousels can be auto-played as an animation or it can be played manually through swipes.
- Kivy provides several customizations to a Carousel that include:
- Animation effect while transition is made from one slide to another slide, duration of the transition period
- Specifying the direction of the swipe
- Disabling vertical swipes
- Whether the carousel should loop infinitely or not
- Specification of minimum distance to be considered while accepting a swipe
- Specification of minimum duration to be considered while accepting a swipe
- Specifying current, previous and next slides
from kivy.app import App
from kivy.uix.carousel import Carousel
from kivy.uix.image import AsyncImage
carouselObject = Carousel(direction='left')
for i in range(4):
imageFile = "./%d.jpg" % i
asyncImageObject = AsyncImage(source = imageFile)
carouselObject.index = 2
# Start the Carousel App
if __name__ == '__main__':