1

I am using Kivy Carousel to build an App.

However I would like to maintain Manual control of the carousel and disable the swipe action (I will manually call carousel.load_next)

I have looked through the Documentation but cannot see any way to disable the swipe action.

If anyone could help me I would appreciate it.

Many thanks, Seotha.

Seotha
  • 13
  • 3

3 Answers3

0

You can disable the user swipe by controling the scroll_timeout. If you simply set it to 0 the user will be unable to trigger the scroll event.

from kivy.app import App
from kivy.uix.carousel import Carousel
from kivy.uix.image import AsyncImage


class CarouselApp(App):
    def build(self):
        carousel = Carousel(direction='right', scroll_timeout=0)
        for i in range(10):
            src = "http://placehold.it/480x270.png&text=slide-%d&.png" % i
            image = AsyncImage(source=src, allow_stretch=True)
            carousel.add_widget(image)
        return carousel


CarouselApp().run()
Arthur Pereira
  • 1,509
  • 2
  • 8
  • 18
0

Thanks Authur, I will mark as Answer. I also discovered I can subclass Carousel and override on_touch_move with nothing.

class MyCarousel(Carousel): def on_touch_move(self,touch): pass

Seotha
  • 13
  • 3
0

The following might be helpful:

use

scroll_distance: '<x>dp'
FChm
  • 2,515
  • 1
  • 17
  • 37