简体   繁体   English

Python Kivy条件布局

[英]Python Kivy conditional Layout

I am building a Kivy application which will serve as a SmartMirror. 我正在构建一个将用作SmartMirror的Kivy应用程序。 The mirror is supposed to go into the main menu, which I already programmed, if a certain event fired, otherwise the screen should remain black. 如果触发某个事件,则应该将镜子转到我已经编程的主菜单中,否则屏幕应保持黑色。 This means on that event I need to load all the body.kv file and after a certain timeout the body should be unloaded. 这意味着在这种情况下,我需要加载所有body.kv文件,并且在超时后应卸载该body。

Builder.load_file('smartmirror.kv')
Builder.load_file('headerspace.kv')
Builder.load_file('bodyspace.kv')
Builder.load_file('footerspace.kv')

if __name__ == '__main__':
    app = SmartMirrorApp()
    app.run()

How do I do this the best way? 我如何做到最好?

Have a look https://kivy.org/docs/api-kivy.uix.screenmanager.html . 看看https://kivy.org/docs/api-kivy.uix.screenmanager.html

ScreenManager can manage your blank/main screen transitions ScreenManager可以管理您的空白/主屏幕过渡

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM