2

11.1

Is anyone knows how to disable the bounce scroll effect when going up in a scrollview ? I've done a scrollview with 100 buttons to test and when I reach the top by finger scrolling, and I stop scrolling, kivy force me to bounce to the 4th button, i would like him to stop to the first button. Do you know how ? Thanks

Here is my code :

import kivy
kivy.require('1.11.1')
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.scrollview import ScrollView
from kivy.core.window import Window
from kivy.app import runTouchApp
from kivy.app import App
from kivy.effects.scroll import ScrollEffect
from kivy.effects.dampedscroll import DampedScrollEffect
from kivy.properties import NumericProperty

layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
layout.bind(minimum_height=layout.setter('height'))

for i in range(100):

    btn = Button(text=str(i), size_hint_y= None, height=40)
    layout.add_widget(btn)

root = ScrollView(size_hint=(1, None),\
size=(Window.width, Window.height),\
bar_width = 10, bar_color= (0,1,0,1),\
scroll_type = ['bars', 'content'],\
effect_cls = 'ScrollEffect'\
)

root.add_widget(layout)

print(root.effect_y)
runTouchApp(root)
  • I tested your code in my machine, windows 10, python2.7 and kivy=1.11.1 and I don't get the bouncing effect that you mention, I scrolled all the way to the bottom and back to the top and it does not bounce at either end, it stays at the first button when scrolled to top, with not bounce, and stays at last button when scrolled to bottom, with not bounce. – Diego Suarez Jun 26 '20 at 01:14
  • Hi Diego ! Thank you for your quick reply ! – xavier cattelain Jun 26 '20 at 09:25

1 Answers1

0

Set the size_hint_y of layout to a value bigger than on where it cover all you items in you layout (e.g. 3) see: Problem with Kivy when trying to scrolldown vertical ScrollView with an horizontal ScrollView inside

root = ScrollView(size_hint=(3, None)
n4321d
  • 1,059
  • 2
  • 12
  • 31