5

I want to stop the user from over scrolling. kivy doc say that the effects_cls property will change this behavior, but I have not found a way to make it work.

supreme
  • 353
  • 3
  • 14
  • I don't want to subclass my own effect, I just want to change the default behavior to some other predefined kivy behavior. – supreme Jun 23 '17 at 19:21

2 Answers2

5

Although you have solved your problem I will provide an example for future users.

You can change what effect is being used by setting effect_cls to any effect class. If you want to disable the overscroll effect to prevent the scroll bouncing effect ScrollEffect solve the problem.

Example using kivy Language:

from kivy.app import App
from kivy.uix.scrollview import ScrollView
from kivy.lang import Builder


Builder.load_string('''
#:import ScrollEffect  kivy.effects.scroll.ScrollEffect
#:import Button kivy.uix.button.Button
<RootWidget>
    effect_cls: ScrollEffect
    GridLayout:
        size_hint_y: None
        height: self.minimum_height
        cols: 1
        on_parent:
            for i in range(10): self.add_widget(Button(text=str(i), size_hint_y=None))
''')

class RootWidget(ScrollView):
    pass

class MainApp(App):
    def build(self):
        root = RootWidget()
        return root

if __name__ == '__main__':
    MainApp().run()

Output:

enter image description here

FJSevilla
  • 3,733
  • 1
  • 13
  • 20
0

so I was trying to use effect_cls: ScrollEffect when it should be effect_cls: 'ScrollEffect'. have to pass it as a string.

supreme
  • 353
  • 3
  • 14