2016-09-27 37 views
0

practice screenScrollView在一个anchorlayout中。蟒蛇。 kivy

这是从.py文件

的屏幕是由屏幕管理控制,你可以看到

class Practice_Page(Screen): 
    pass 

class PracticeList(BoxLayout): 
    def practicelist(ScrollView): 

     practicelist.bind(minimum_height=layout.setter('height')) 

.KV文件:

<Practice_page>: 
    canvas.before: 
     Rectangle: 
      pos: self.pos 
      size: self.size 
      source: 'background1.png' 


    AnchorLayout: 
     anchor_x: 'center' 
     anchor_y: 'center' 
     PracticeList: 
      size: 900,30 
      size_hint: None,None 
      do_scroll_x: False   
      BoxLayout: 
       orientation: 'vertical' 
       padding: 10 
       cols: 1 
       Button: 
        text: 'The Real Number System'   
        on_press: root.manager.current = 'open_topics' 
       Button: 
        text: 'Absolute Value' 
        on_press: root.manager.current = 'open_practice' 
       Button: 
        text: 'Operations W/ Integers & Fractions'   
        on_press: root.manager.current = 'open_topics'      
       Button: 
        text: 'Operations W/ Zero' 
        on_press: root.manager.current = 'open_formulas' 

我有约30多个按钮。我不知道我做错了什么,任何帮助或建议都会非常有帮助。

+0

试着解释更多,我现在不知道你的问题是什么。如果你更好地解释它,那么我可能会帮助你。 –

+0

@MatthiasSchreiber你可以从图像中看到,所有的按钮都堆叠在彼此的顶部,所以你可以看到它们..我想添加一个滚动视图到anchorlayout,因此用户可以滚动浏览主题名称列表。再次感谢你,我很感激 –

回答

0
AnchorLayout: 
    anchor_x: 'center' 
    anchor_y: 'center' 
    ScrollView: 
     #size: 900,30 
     size: self.size 
     #do_scroll_x: False   
     GridLayout: 
      # orientation: 'vertical' 
      #padding: 10 
      size_hint_y: None 
      height: self.minimum_height 
      cols: 1 
      Button: 
       size_hint_y: None 
       text: 'The Real Number System'   
       on_press: root.manager.current = 'open_topics' 
      Button: 
       size_hint_y: None 
       text: 'Absolute Value' 
       on_press: root.manager.current = 'open_practice' 
      Button: 
       size_hint_y: None 
       text: 'Operations W/ Integers & Fractions'   
       on_press: root.manager.current = 'open_topics'      
      Button: 
       size_hint_y: None 
       text: 'Operations W/ Zero' 
       on_press: root.manager.current = 'open_formulas' 

      ##MORE BTNS 

对于任何需要它的人。