E
E
Evgeny Lavrov2019-11-09 23:42:58
Python
Evgeny Lavrov, 2019-11-09 23:42:58

Why doesn't the kivy python application start?

The code:

from kivy.app import App
from kivy.uix.button import Button

class MyApp():
  def build(self):
    return Button()

if __name__ == '__main__':
  MyApp().run()

Result:
5dc7248577832174881911.png
[INFO   ] [Logger      ] Record log in C:\Users\Студия\.kivy\logs\kivy_19-11-10_6.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.17
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.22
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\Студия\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]
[INFO   ] [Python      ] Interpreter at "C:\Users\Студия\AppData\Local\Programs\Python\Python37-32\python.exe"
[INFO   ] [Logger      ] Purge log fired. Analysing...
[INFO   ] [Logger      ] Purge finished!
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
 Traceback (most recent call last):
   File "C:\Users\Студия\Documents\python kivy\main.py", line 9, in <module>
     MyApp().run()
 AttributeError: 'MyApp' object has no attribute 'run'
[Finished in 1.6s with exit code 1]
[shell_cmd: python -u "C:\Users\Студия\Documents\python kivy\main.py"]
[dir: C:\Users\Студия\Documents\python kivy]
[path: C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter\Driver;;;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AMD\ATI.ACE\Core-Static;C:\Program Files\Brackets\command;C:\Users\Студия\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\Студия\AppData\Local\Programs\Python\Python37-32\]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_, 2019-11-10
@lavrov2002

You won't get MyApp from App kivy, it must be
class MyApp(App):

K
Konstantin Malyarov, 2019-11-09
@Konstantin18ko

AttributeError: 'MyApp' object has no attribute 'run'

White on black, there is no run attribute in myapp.
class MyApp():
  def run(self):
    return Button()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question