2016-09-14 25 views
0

私はKivyライブラリのPythonアプリケーションに問題があります。特に私は、TabbedPanelItemの要素のスクロール可能なリストを作成しようとしていますが、私のリストがスクロールしない理由はわかりません。Kivy - 私のScrollViewはスクロールしません

#:import sm kivy.uix.screenmanager 
ScreenManagement: 
    transition: sm.FadeTransition() 
    SecondScreen: 

<SecondScreen>: 
    tabba: tabba 
    name: 'second' 
    FloatLayout: 
     background_color: (255, 255, 255, 1.0) 
     BoxLayout: 
      orientation: 'vertical' 
      size_hint: 1, 0.10 
      pos_hint: {'top': 1.0} 
      canvas: 
       Color: 
        rgba: (0.98, 0.4, 0, 1.0) 
       Rectangle: 
        pos: self.pos 
        size: self.size 
      Label: 
       text: 'MyApp' 
       font_size: 30 
       size: self.texture_size 

     BoxLayout: 
      orientation: 'vertical' 
      size_hint: 1, 0.90 
      Tabba: 
       id: tabba 

     BoxLayout: 
      orientation: 'vertical' 
      size_hint: 1, 0.10 
      pos_hint: {'bottom': 1.0} 
      Button: 
       background_color: (80, 1, 0, 1.0) 
       text: 'Do nop' 
       font_size: 25 


<Tabba>: 
    do_default_tab: False 
    background_color: (255, 255, 255, 1.0) 

    TabbedPanelItem: 
     text: 'First_Tab' 
     Tabs: 

    TabbedPanelItem: 
     text: 'Second_Tab' 
     Tabs: 

    TabbedPanelItem: 
     text: 'Third_Tab' 
     Tabs: 


<Tabs>: 
    grid: grid 
    ScrollView: 
     scroll_timeout: 250 
     scroll_distance: 20 
     do_scroll_y: True 
     do_scroll_x: False 
     GridLayout: 
      id: grid 
      cols: 1 
      spacing: 10 
      padding: 10 
      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) 
     Label: 
      text:'scroll' 
      color: (0, 0, 0, 1.0) 

そして、ここに私の.pyコード::私は間違っている/何をやっている

__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 ScrollView 

class Tabs(ScrollView): 
    def __init__(self, **kwargs): 
     super(Tabs, self).__init__(**kwargs) 


class Tabba(TabbedPanel): 
    pass 


class SecondScreen(Screen): 
    pass 

class ScreenManagement(ScreenManager): 
    pass 

presentation = Builder.load_file("layout2.kv") 

class MyApp(App): 

    def build(self): 
     return presentation 


MyApp().run() 

ここ

は私のKVファイルのですか?

私自身は、しばらくの間、kivyを使用していない

答えて

1

(コメントとも受け入れられるUIの改善のための示唆)が、私はexacly覚えていれば: はScrollView内のレイアウトは、スクロールビュー EX ScrollView幅よりも大きくする必要があるため:1000px、GridView 1100px 100pxでスクロールすることが可能

+0

したがって、内部レイアウトの高さをScrollViewよりも小さく設定することをお勧めしますか? – Drakenden

+1

Drakendenいいえ大きくなるはずです:) –

+0

最後に、私はGridViewよりもScrollViewの高さを大きく設定しました。ありがとうございました! – Drakenden

関連する問題