kv 文件中的按钮不会重定向到所需的页面
Button in kv file doesn't redirect to the desired page
您好,我的代码有问题:正如您在标题中所读到的,我有这个按钮,它应该将用户重定向到另一个页面,但是当点击它时它没有做任何事情。你能帮帮我吗?
这是代码
这里我定义了按钮
<Home>:
name: "home"
BoxLayout:
orientation: "vertical"
pos_hint: {"center_x": .5}
size_hint: .7, 1
Label:
text: "Home"
font_size: 50
Label:
text: ""
Button:
text: "FAQ"
on_release:
app.root.current: "FAQ_AP"
root.manager.transition.direction = "left"
Label:
text: ""
Button:
text: "Gestionale"
on_release:
Label:
text: ""
我在这里创建了按钮应该重定向到的页面:
<FAQ_AP>:
name: "FAQ_AP"
BoxLayout:
orientation: "vertical"
pos_hint: {"center_x": .5}
size_hint: .7, 1
Label:
font_size: 50
text: "Sei un'azienda o un privato?"
Label:
text: ""
Label:
text: ""
Button:
text: "Azenda"
on_release:
Label:
text: ""
Button:
text: "Privato"
on_release:
Label:
text: ""
如果你能帮助我,那将是最好的。提前谢谢你。
您无需在按钮的 on_release
功能中提及 .app
。
用这个,效果很好
Button:
text: "FAQ"
on_release:
root.manager.current = "FAQ_AP"
root.manager.transition.direction = "left"
您好,我的代码有问题:正如您在标题中所读到的,我有这个按钮,它应该将用户重定向到另一个页面,但是当点击它时它没有做任何事情。你能帮帮我吗?
这是代码
这里我定义了按钮
<Home>:
name: "home"
BoxLayout:
orientation: "vertical"
pos_hint: {"center_x": .5}
size_hint: .7, 1
Label:
text: "Home"
font_size: 50
Label:
text: ""
Button:
text: "FAQ"
on_release:
app.root.current: "FAQ_AP"
root.manager.transition.direction = "left"
Label:
text: ""
Button:
text: "Gestionale"
on_release:
Label:
text: ""
我在这里创建了按钮应该重定向到的页面:
<FAQ_AP>:
name: "FAQ_AP"
BoxLayout:
orientation: "vertical"
pos_hint: {"center_x": .5}
size_hint: .7, 1
Label:
font_size: 50
text: "Sei un'azienda o un privato?"
Label:
text: ""
Label:
text: ""
Button:
text: "Azenda"
on_release:
Label:
text: ""
Button:
text: "Privato"
on_release:
Label:
text: ""
如果你能帮助我,那将是最好的。提前谢谢你。
您无需在按钮的 on_release
功能中提及 .app
。
用这个,效果很好
Button:
text: "FAQ"
on_release:
root.manager.current = "FAQ_AP"
root.manager.transition.direction = "left"