固定布局中的滚动视图。Python。基维

2024-03-28 23:14:53 发布

您现在位置:Python中文网/ 问答频道 /正文

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个纽扣。我不知道我做错了什么,任何帮助或建议都会很有帮助。你知道吗


Tags: 文件textsize屏幕onmanagerbuttonroot
1条回答
网友
1楼 · 发布于 2024-03-28 23:14:53
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

给任何需要的人。你知道吗

相关问题 更多 >