Error in basic code in Kivy (Python)

1

I made a very simple code using Kivy, but of the error that is showing in the image below: The code is as follows:

import kivy
kivy.require('1.0.6')

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

class MyApp(App):
    def build(self):
        return Button(text='Hello World')

if __name__ in ('__android__', '__main__'):
    MyApp().run()

Could you explain what's wrong?

    
asked by anonymous 04.11.2017 / 17:20

2 answers

0

On the official website of the Kivy library ( link ) you can see an example of use. The library is already in version 1.10.0.

The following example comes straight from the official website and will display a "Hello World" button:

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

class MyApp(App):
   def build(self):
      return Button(text = 'Hello World')

MyApp().run()

As you can see, it's very similar to your code!

    
14.11.2017 / 01:15
0

I know the question is a few months old, but if someone is looking for the answer, it's here.

Some Kivy features require you to install dependencies so that these features can work properly. These dependencies are not installed automatically so as not to hamper the application's performance by installing unnecessary things for your project, so they are done separately.

In the Installation Guide you have the pro explanation you need: link

But just by running these two command lines you can already get the main dependencies:

pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew 
pip install kivy.deps.gstreamer 
    
19.09.2018 / 19:09