ScrollView - Won't scroll - keeps bouncing

31 views
Skip to first unread message

Dan Moormann

unread,
Apr 1, 2024, 11:59:26 PMApr 1
to Kivy users support
I asked you about this a long time ago and we got it to work with my original app (crash/tutorial).  I tried to model my new app on what we did then but no luck.

This is a simple app I'm trying to set up for my grandkids.  Everything is working except the scrolling of the colormap data.  Sizing and positioning are perfect, but it just bounces back to the top of the list.

I tried a lot of stuff I found on the web, but nothing seems to work.

You said that the child needs to be smaller than the scrollview.  I just don't get it.

grid.kv
main.py
linenum.py

elli...@cox.net

unread,
Apr 2, 2024, 10:05:16 AMApr 2
to Kivy users support
The child layout in a ScrollView, needs to be larger than the scrollview if t is going to scroll.  It also needs to be a fixed size( in the x or y direction).

Imagine the scrollview is a window cut in a piece of paper with a larger piece of paper behind it.  If the paper behind is too small, it will not scroll.  If the paper behind is sized with hints it fits in the window and doesn't move.  The size needs to be fixed. 

In this case you have one line to add to your code, you need to set the height of the GridLayout contained in the ScrollView.
You do that by setting  height: self.minimum_height
self.minium_height gets calculated by the layout, it is the height required to contain the children in the layout.

ScrollView
   id: scroll
   name: 'scroll'
   size_hint: .333,1
   scroll_type: ['bars','content']
   do_scroll_x: False
   do_scroll_y: True
   scroll_y: 1    #top of scrollview
   bar_color: 1,0,0,1    #red
   bar_width: 15


   GridLayout:
       #orientation: 'vertical'
       id: scrollbox
       name: 'scrollbox'
       cols: 1
       spacing: 1
       size_hint_y: None
       height: self.minimum_height  # set the height


From: kivy-...@googlegroups.com <kivy-...@googlegroups.com> on behalf of Dan Moormann <dan...@gmail.com>
Sent: Monday, April 1, 2024 8:59 PM
To: Kivy users support <kivy-...@googlegroups.com>
Subject: [kivy-users] ScrollView - Won't scroll - keeps bouncing
 
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/09f944c3-a890-4609-b8f9-af0d9de974cbn%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages