Kivy - My ScrollView doesnt scroll

2024/10/13 20:15:49

I'm having problems in my Python application with Kivy library. In particular I'm trying to create a scrollable list of elements in a TabbedPanelItem, but I don't know why my list doesn't scroll.

Here is my kv file:

#:import sm kivy.uix.screenmanager
ScreenManagement:transition: sm.FadeTransition()SecondScreen:<SecondScreen>:tabba: tabbaname: 'second'FloatLayout:background_color: (255, 255, 255, 1.0)BoxLayout:orientation: 'vertical'size_hint: 1, 0.10pos_hint: {'top': 1.0}canvas:Color:rgba: (0.98, 0.4, 0, 1.0)Rectangle:pos: self.possize: self.sizeLabel:text: 'MyApp'font_size: 30size: self.texture_sizeBoxLayout:orientation: 'vertical'size_hint: 1, 0.90Tabba:id: tabbaBoxLayout:orientation: 'vertical'size_hint: 1, 0.10pos_hint: {'bottom': 1.0}Button:background_color: (80, 1, 0, 1.0)text: 'Do nop'font_size: 25<Tabba>:do_default_tab: Falsebackground_color: (255, 255, 255, 1.0)TabbedPanelItem:text: 'First_Tab'Tabs:TabbedPanelItem:text: 'Second_Tab'Tabs:TabbedPanelItem:text: 'Third_Tab'Tabs:<Tabs>:grid: gridScrollView:scroll_timeout: 250scroll_distance: 20do_scroll_y: Truedo_scroll_x: FalseGridLayout:id: gridcols: 1spacing: 10padding: 10Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)Label:text:'scroll'color: (0, 0, 0, 1.0)

And here my .py code:

__author__ = 'drakenden'__version__ = '0.1'import kivy
kivy.require('1.9.0') # replace with your current kivy version !from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.properties import StringProperty, ObjectProperty,NumericProperty
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.utils import platform
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollViewclass Tabs(ScrollView):def __init__(self, **kwargs):super(Tabs, self).__init__(**kwargs)class Tabba(TabbedPanel):passclass SecondScreen(Screen):passclass ScreenManagement(ScreenManager):passpresentation = Builder.load_file("layout2.kv")class MyApp(App):def build(self):return presentationMyApp().run()

Where/What am I doing wrong?

(Comments and suggests for UI improvements are also accepted)

Answer

I Myself haven't used kivy for a while but if I remember exacly: Because layout within ScrollView should be BIGGER than scroll view ex ScrollView width: 1000px, GridView 1100px. So it will be possible to scroll it by 100px

https://en.xdnf.cn/q/118040.html

Related Q&A

How to get an associated model via a custom admin action in Django?

Part 2 of this question asked and answered separately.I have a Report and a ReportTemplate. +----+----------+---------------+-------------+ | id | title | data | template_id | +----+-------…

How can I use descriptors for non-static methods?

I am aware that I can use descriptors to change static property as if it were a normal property. However, when I try using descriptors for a normal class property, I end up changing the object it refer…

psycopg2 not all arguments converted during string formatting

I am trying to use psycopg2 to insert a row into a table from a python list, but having trouble with the string formatting.The table has 4 columns of types (1043-varchar, 1114-timestamp, 1043-varchar, …

inherited function odoo python

i want to inherit function in module hr_holidays that calculate remaining leaves the function is :hr_holiday.py:def _get_remaining_days(self, cr, uid, ids, name, args, context=None):cr.execute("&…

ValueError in pipeline - featureHasher not working?

I think Im having issues getting my vectorizer working within a gridsearch pipeline:data as panda df x_train:bathrooms bedrooms price building_id manager_id 10 1.5 3 3000 53a5b119b…

pandas dataframe: meaning of .index

I am trying to understand the meaning of the output of the following code:import pandas as pdindex = [index1,index2,index3] columns = [col1,col2,col3] df = pd.DataFrame([[1,2,3],[1,2,3],[1,2,3]], index…

Extract text inside XML tags with in Python (while avoiding p tags)

Im working with the NYT corpus in Python and attempting to extract only whats located inside "full_text" class of every .xml article file. For example: <body.content><block class=&qu…

Python (Flask) and MQTT listening

Im currently trying to get my Python (Flask) webserver to display what my MQTT script is doing. The MQTT script, In essence, its subscribed to a topic and I would really like to categorize the info it …

I dont show the image in Tkinter

The image doesnt show in Tkinter. The same code work in a new window, but in my class it does not. What could be the problem ?import Tkinterroot = Tkinter.Tkclass InterfaceApp(root):def __init__(self,…

Read temperature with MAX31855 Thermocouple Sensor on Windows IoT

I am working on a Raspberry Pi 2 with Windows IoT. I want to connect the Raspberry Pi with a MAX31855 Thermocouple Sensor which I bought on Adafruit. Theres a Python libary available on GitHub to read …