【发布时间】:2018-10-06 21:39:48
【问题描述】:
3 个文件。 test.py, myfunctions.py & test.kv
试图从 test.kv 中的 myfunctions.py 调用一个函数
test.py
from kivy.app import App
import myfunctions
class TestApp(App):
title = 'Test Application'
pass
if __name__ == '__main__':
TestApp().run()
myfunctions.py
def myfunc():
print('hello world')
test.kv
GridLayout:
Button:
text: "My Button"
on_release: myfunc()
我也尝试过在应用程序类中定义函数(根据 kivy 文档) - 没用
我错过了什么?
【问题讨论】:
标签: python-3.x kivy