在anchorlayout中的ScrollView。蟒蛇。 kivy

时间:2016-09-27 18:08:16

标签: python scrollview kivy

practice screen

这是来自.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多个按钮。我不知道我做错了什么,任何帮助或建议都会非常有用。

1 个答案:

答案 0 :(得分: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

对于任何需要它的人。