【问题标题】:Python Kivy GridLayout, positioningPython Kivy GridLayout,定位
【发布时间】:2022-01-05 16:05:01
【问题描述】:

see image here

大家好,我是 kivy 新手,无法获得预期的结果。

: 作品名称:《测试》 网格布局: 行数:2 列数:2 间距:20 画布之前: 颜色: RGBA:0、1、0、1 长方形 尺寸:self.size pos: self.pos

    GridLayout:
        rows:1
        cols:2
        size: 200, 200
        size_hint: None, None

        GridLayout:
            rows: 1
            cols: 2

            Button:
                text: "test0-1"
                size: 100, 100
                size_hint: None, None
            Button:
                text: "test0-2"
                size: 100, 100
                size_hint: None, None
        Button:
            text: "test01-1"
            size: 200, 100
            size_hint: None, None

    Button:
        text: "test1"
        size_hint: None, None
        size: 500, 500

【问题讨论】:

    标签: python user-interface kivy


    【解决方案1】:

    : 作品名称:《测试》 网格布局: 行数:1 列数:2 #间距:20 画布之前: 颜色: RGBA:0、1、0、1 长方形 尺寸:self.size pos: self.pos

        GridLayout:
            rows:2
            cols:1
            size: 200, root.size[1]
            size_hint: None, None
            #pos_hint:{"x":1,"y":1}
    
            GridLayout:
                rows: 1
                cols: 2
                Button:
                    text: "test0-1"
                    size: 100, 100
                    size_hint: None, None
                Button:
                    text: "test0-2"
                    size: 100, 100
                    size_hint: None, None
    
            Button:
                text: "test01-1"
                size: 200, root.size[1] - 100
                size_hint: None, None
    
    
        Button:
            text: "test1"
            #size_hint: .7
            #size: 500, 500[enter image description here][1]
    

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 1970-01-01
    • 2017-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多