2016-09-27 35 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 

對於任何需要它的人。