【发布时间】:2020-09-21 11:43:00
【问题描述】:
大家。怎么样了?
我找不到任何与此相关的帖子,所以在这里:
我正在研究 kivy,我对它的基础有一些疑问。在 Kivy 中引用对象的“name:”和“id:”有什么区别?
这是我用作示例的代码示例。请注意,我使用“name”属性从“Screen”类中引用对象,该属性运行良好,并且我还可以使用“id”属性从“TextInput”和“Button”中引用对象的值:
<Button>:
size_hint: 0.24, 0.1
<TextInput>:
size_hint: 0.4, 0.1
ScreenManager:
Screen:
name: 'login_page'
TextInput:
id: email
Button:
id: login_button
text: 'Go to main page'
pos_hint: {"x": 0.38, "top": 0.2}
on_release:
app.root.current = 'main_page'
root.transition.direction = 'left'
Screen:
name: 'main_page'
FloatLayout:
Button:
text: 'Go to login page'
pos_hint: {"x": 0.38, "top": 0.2}
on_release:
app.root.current = 'login_page'
root.transition.direction = 'right'
【问题讨论】:
标签: python attributes kivy