Beginner question - class definition error

Cousin Stanley cousinstanley at gmail.com
Wed Jan 28 08:59:49 EST 2015


> 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()
>
> ....
>
> I get this error when I run it:
> ....
>
> Traceback (most recent call last):
>   File "MinimalApplication.py", line 7, in <module>
>     class MyApp(App):
>   File "MinimalApplication.py", line 12, in MyApp
>     MyApp().run()
> NameError: name 'MyApp' is not defined
>
> How can I fix this please?
 
  Try removing beginning indentation 
  from ....

    if __name__ == '__main__': 
  
if __name__ == '__main__':


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona



More information about the Python-list mailing list