如何在没有任何悬垂的情况下将小部件锚定在屏幕右侧.Kivy Python


<GeneratorScreen>:
BoxLayout:
orientation:'vertical'
size: root.width, root.height
AnchorLayout:
anchor_x: "right"
anchor_y: "top"
size: 300, root.height
BoxLayout:
orientation:'vertical'
GridLayout:
size_hint: None, None
pos_hint: {'x': .9, 'y': .9}
size:200, 200
cols: 3
Button:
id: settlement_button
text: 'Settlement'
font_size: 10
pos_hint: {'x': .901, 'y': .87}
size_hint: None, None
size: 67, 20
on_press: root.test()
Button:
id: npc_button
text: 'Npc'
font_size: 10
pos_hint: {'x': .93, 'y': .87}
size_hint: None, None
size: 67, 20 
Button:
id: npc_button
text: 'Store'
font_size: 10
pos_hint: {'x': .93, 'y': .87}
size_hint: None, None
size: 67, 20 
Button:
id: npc_button
text: 'other'
font_size: 10
pos_hint: {'x': .93, 'y': .87}
size_hint: None, None
size: 67, 20 

我正在尝试将一些小部件锚定在窗口的右侧,即使在调整窗口大小时也是如此。按钮在屏幕外的一侧有径流。我该如何防止这种情况发生?屏幕外按钮也可以屏幕外按钮不同的窗口大小

您可以使用:

pos_hint: {'right':1.0}

Se文档。

最新更新