I developed a GUI with KivyMD. It consists of eight box layout arranged vertically in another Box Layout. I started adding checkbox, labels and DropDownItem. Everything appears aligned except for the DropDownItem in the second row. I tried with pos_hint but I cannot move it along the x axis. I would like that the DropDownItem begins where the first checkbox of row1 begins.
Here is the full Kivy kv code:
<InitializeComponent>:
orientation: 'vertical'
padding: 20
MDBoxLayout:
MDLabel:
text: 'row 1'
MDCheckbox:
MDLabel:
text: 'Item 1'
MDCheckbox:
MDLabel:
text: 'Item 2'
MDCheckbox:
MDLabel:
text: 'Item 3'
MDCheckbox:
MDLabel:
text: 'Item 4'
Widget:
size_hint_x: None
width: myCombo.width
Widget:
size_hint_x: None
width: myCombo.width
MDBoxLayout:
MDLabel:
text: 'row 2___________'
MDDropDownItem:
text: 'select'
pos_hint: {"left":1, "center_y":0.5}
Widget:
Widget:
Widget:
Widget:
Widget:
Widget:
Widget:
MDDropDownItem:
id: myCombo
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
id: myCombo
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDLabel:
text: 'row____3'
MDCheckbox:
MDLabel:
text: 'Item 5'
MDCheckbox:
MDLabel:
text: 'Item 6'
MDCheckbox:
MDLabel:
text: 'Item 7'
Widget:
Widget:
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDLabel:
text: 'row____4_____'
MDCheckbox:
MDLabel:
text: 'Item 8'
Widget:
Widget:
Widget:
Widget:
Widget:
Widget:
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDLabel:
text: 'row____5'
MDCheckbox:
MDLabel:
text: 'Item 9'
MDCheckbox:
MDLabel:
text: 'Item 10'
Widget:
Widget:
Widget:
Widget:
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDLabel:
text: 'row____6'
MDCheckbox:
MDLabel:
text: 'Item 11'
Widget:
Widget:
Widget:
Widget:
Widget:
Widget:
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDLabel:
text: 'row____7_______'
MDCheckbox:
MDLabel:
text: 'Item 12'
Widget:
Widget:
Widget:
Widget:
Widget:
Widget:
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDDropDownItem:
text: 'select'
pos_hint: {"center_y":0.5}
MDBoxLayout:
MDRaisedButton:
text: 'BUTTON'
size_hint: 1, None
pos_hint: {"center_x":0.5, "center_y&开发者_开发问答quot;:0.5}
Any tip to keep the widgets aligned?
精彩评论