BoxLayout设计

时间:2016-07-17 16:30:46

标签: python kivy

这是我的代码:

layout = BoxLayout(orientation='horizontal')
    layout2 = BoxLayout(orientation='vertical')

    button1 = Button()
    button2 = Button()
    button3 = Button()
    button4 = Button()
    button5 = Button()
    button6 = Button()


    layout.add_widget(button1)
    layout.add_widget(button2)
    layout.add_widget(button3)
    layout2.add_widget(button4)
    layout2.add_widget(button5)
    layout2.add_widget(button6)

    layout.add_widget(layout2)

    return layout

这是我得到的输出。

http://i.stack.imgur.com/ei9br.png

如何将小方框从右侧移到左侧?

1 个答案:

答案 0 :(得分:0)

关于添加小部件的顺序。

将其更改为

layout = BoxLayout(orientation='horizontal')
layout2 = BoxLayout(orientation='vertical')

button1 = Button()
button2 = Button()
button3 = Button()
button4 = Button()
button5 = Button()
button6 = Button()

layout2.add_widget(button4)
layout2.add_widget(button5)
layout2.add_widget(button6)

layout.add_widget(layout2)

layout.add_widget(button1)
layout.add_widget(button2)
layout.add_widget(button3)