есть python 3 код, запущенный на windows 10
import kivy
from kivy.app import App
class IdeApp(App):
def printer():
return 'pechat'
IdeApp().run()
есть код на kv (название файла ide.kv)
BoxLayout:
Label:
id: hell
text: 'hello'
Button:
text: 'press me'
on_press: hell.text = IdeApp.printer()
И он при нажатии на кнопку выдает ошибку такую.
Traceback (most recent call last):
File "ide.py", line 8, in <module>
IdeApp().run()
File "C:\Python34\lib\site-packages\kivy\app.py", line 828, in run
runTouchApp()
File "C:\Python34\lib\site-packages\kivy\base.py", line 487, in runTouchApp
EventLoop.window.mainloop()
File "C:\Python34\lib\site-packages\kivy\core\window\window_sdl2.py", line 619, in mainloop
self._mainloop()
File "C:\Python34\lib\site-packages\kivy\core\window\window_sdl2.py", line 362, in _mainloop
EventLoop.idle()
File "C:\Python34\lib\site-packages\kivy\base.py", line 330, in idle
self.dispatch_input()
File "C:\Python34\lib\site-packages\kivy\base.py", line 315, in dispatch_input
post_dispatch_input(*pop(0))
File "C:\Python34\lib\site-packages\kivy\base.py", line 221, in post_dispatch_input
listener.dispatch('on_motion', etype, me)
File "kivy\_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7699)
File "C:\Python34\lib\site-packages\kivy\core\window\__init__.py", line 1030, in on_motion
self.dispatch('on_touch_down', me)
File "kivy\_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7699)
File "C:\Python34\lib\site-packages\kivy\core\window\__init__.py", line 1046, in on_touch_down
if w.dispatch('on_touch_down', touch):
File "kivy\_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7699)
File "C:\Python34\lib\site-packages\kivy\uix\widget.py", line 432, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy\_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7699)
File "C:\Python34\lib\site-packages\kivy\uix\behaviors\button.py", line 110, in on_touch_down
self.dispatch('on_press')
File "kivy\_event.pyx", line 714, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7654)
File "kivy\_event.pyx", line 1224, in kivy._event.EventObservers.dispatch (kivy\_event.c:13497)
File "kivy\_event.pyx", line 1108, in kivy._event.EventObservers._dispatch (kivy\_event.c:12329)
File "C:\Python34\lib\site-packages\kivy\lang.py", line 1557, in custom_callback
exec(__kvlang__.co_value, idmap)
File ".\ide.kv", line 7, in <module>
on_press: hell.text = Ide.printer()
NameError: name 'Ide' is not defined
Почему?