Reputation: 9
I'm trying to run the basic example from the Kivy documentation (using python 3.10.4, vscode and windows 10):
import kivy
kivy.require('2.1.0')
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == ' main ':
MyApp().run()
When i run, the following output is showed at the terminal:
[INFO ] [Logger ] Record log in C:\Users\Julio Cesar\.kivy\logs\kivy_22-12-23_7.txt
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.3
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.4.5
[INFO ] [Kivy ] v2.1.0
[INFO ] [Kivy ] Installed at "C:\Users\Julio Cesar\AppData\Local\Programs\Python\Python310\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\Julio Cesar\AppData\Local\Programs\Python\Python310\python.exe"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [Factory ] 189 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
PS C:\Users\Julio Cesar\Documents\Códigos Python\ilgui>
But from what i saw, it was supposed to generate a window with the given string. And that is not happening here, just this output and then the terminal command line shows again. Anyone can enlighten me? Thanks in advance.
I tried uninstalling kivy and python.
Upvotes: 0
Views: 103
Reputation: 304
The problem is with your if statement where you said if __name__ == ' main '
you need to add double underscores before and after ' main ' to fix this issue.
just like this:
if __name__ == '__main__':
MyApp().run()
Upvotes: 1