如何制作kivy文件的单独模块并与python文件集成

时间:2018-03-28 07:13:51

标签: python user-interface module kivy

我是kivy的初学者,想过为我的项目做一个简单的GUI。

当我开始使用一个python文件和一个kivy文件时,它运行正常。但现在我的计划是制作一个复杂的GUI,其中包含许多代码行和kivy文件正在变大。所以我想到制作单独的kivy模块(这里分别制作kivy文件并导入一个或多个文件)并考虑与python文件集成。我没有找到任何相关的示例/甚至GitHub存储库。

请帮助我解决上述问题。

提前致谢。

1 个答案:

答案 0 :(得分:0)

是的,有可能。

Is it possible to read from more than one .kv file in Kivy app?

Yes it is! You can import .kv files inside files just like normal python files by starting with:

#:include otherfile.kv
If you want the file to unload and reload first you can force the import typing

#:include force otherfile.kv
instead.

All this as written in the Kivy Language Documentation which is full of useful clarifications.
相关问题