On 2015-01-28 11:10, David Aldrich wrote:
Hi

I am just getting started with Python 3.3.3 and Kivy 1.8.

I am using the Kivy  development environment on Windows (open a command prompt 
and call kivy.bat).

With this minimal code:

import kivy
kivy.require('1.8.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()

I get this error when I run it:

C:\>python MinimalApplication.py
[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in <snip>
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG          ] [Cache       ] register <kv.lang> with limit=None, 
timeout=Nones
[DEBUG          ] [Cache       ] register <kv.image> with limit=None, 
timeout=60s
[DEBUG          ] [Cache       ] register <kv.atlas> with limit=None, 
timeout=Nones
[INFO              ] [Image       ] Providers: img_tex, img_dds, img_pygame, 
img_gif (img_pil ignored)
[DEBUG          ] [Cache       ] register <kv.texture> with limit=1000, 
timeout=60s
[DEBUG          ] [Cache       ] register <kv.shader> with limit=1000, 
timeout=3600s
[INFO              ] [Text        ] Provider: pygame
  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?

Unindent the 'if' statement. Currently, it's indented inside the class
definition, so MyApp isn't defined yet.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to