Unable to run Simple Example

DJ Webre d_webre at yahoo.com
Wed Jan 30 09:46:35 EST 2002


Hi

Just installed Python2.2 and wxPython.  My OS is Win NT v4.

I was able to run several demos and samples but when I tried to run the
following, it would not run.

______________________________________
   from wxPython.wx    import *

class MyApp(wxApp):
    def OnInit(self):
        frame = wxFrame(NULL, -1, "Hello World")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

    app = MyApp(0)
    app.MainLoop()
______________________________________________

I save the above as a .py file and ran it by
Start   Program  IDLE(Python GUI)
Open the file and "ran script".
Obtainted the following:
_________________________________________________

Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> 
Traceback (most recent call last):
  File "D:\Data\Python\wxHelloWorld\wxHelloWorld.py", line 5, in ?
    class MyApp(wxApp):
  File "D:\Data\Python\wxHelloWorld\wxHelloWorld.py", line 12, in MyApp
    app = MyApp(0)
NameError: name 'MyApp' is not defined

_____________________________________________

What am I doing wrong?



















































Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> 
Traceback (most recent call last):
  File "D:\Data\Python\wxHelloWorld\wxHelloWorld.py", line 5, in ?
    class MyApp(wxApp):
  File "D:\Data\Python\wxHelloWorld\wxHelloWorld.py", line 12, in MyApp
    app = MyApp(0)
NameError: name 'MyApp' is not defined


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com




More information about the Python-list mailing list