Nếu bạn không biết được bố trí sử dụng, sau đó sử dụng bố trí lưới, bởi vì nó là linh hoạt nhất.
Nói chung, nếu bạn muốn đặt n tiện ích con trong một hàng, hãy đặt rows: 1
. Nếu bạn muốn đặt n tiện ích trong một cột, hãy đặt cols: 1
.
Sau đó, thao tác size_hint
để đặt kích thước chính xác của tiện ích con.
Bạn có thể sử dụng nhãn trống để tạo khoảng trắng giữa các tiện ích.
Giới thiệu về Kivy Designer - tốt hơn hết bạn nên tìm hiểu cách thiết lập giao diện người dùng theo cách thủ công trước khi sử dụng công cụ này.
#:kivy 1.9.0
<[email protected]>:
text: 'gauge'
<[email protected]>:
cols: 1
size_hint_x: .2
RoundGauge:
size_hint_y: .5
RoundGauge:
size_hint_y: .5
GridLayout:
rows: 1
Slider:
orientation: 'vertical'
Slider:
orientation: 'vertical'
# main layout divided into bottom gauges and screen part
GridLayout:
cols: 1
canvas:
Color:
rgba: 1,1,1,.5
Rectangle:
size: self.size
# both side panels and screen part
GridLayout:
rows: 1
# left panel
SidePanel:
# middle panel
GridLayout:
cols: 1
# upper gauges
GridLayout:
rows: 1
size_hint_y: .3
Label:
RoundGauge:
size_hint_x: .5
Label:
size_hint_x: .1
RoundGauge:
size_hint_x: .5
Label:
Label:
text: 'screen'
canvas:
Color:
rgba: 1,1,1,.5
Rectangle:
size: self.size
pos: self.pos
# bottom gauges
GridLayout:
rows: 1
size_hint_y: .3
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
# right panel
SidePanel:
GridLayout:
rows: 1
size_hint_y: .2
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge:
RoundGauge: