Hi all,

I've started the wxPython tutorials and have hit a problem already. 
When run from IDLE or by calling the script from the command line with

[EMAIL PROTECTED]:~/wxpy$ python helloWorld.py

the script works fine, generating a small text editor.  Making the file 
executable and including the shebang, running

[EMAIL PROTECTED]:~/wxpy$ ./helloWorld.py

generates a cross-hair looking mouse pointer.  Clicking the mouse 
generates the following error:

[EMAIL PROTECTED]:~/wxpy$ ./helloWorld.py
./helloWorld.py: line 6: syntax error near unexpected token `('
./helloWorld.py: line 6: `class MainWindow(wx.Frame):'

Which to me looks like it doesn't know what to do with wx.Frame, or some 
problem in extending the class.  In the hello world example previous to 
this, there's no problem with wx.Frame and the program runs when 
executed from the command line.

Here's the details:
python 2.3.5

this one works:

[EMAIL PROTECTED]:~/wxpy$ cat hello.py
#!/usr/bin/python

import wx

app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "Hello World")
frame.Show(1)
app.MainLoop()

--------------------

this one fails:
[EMAIL PROTECTED]:~/wxpy$ cat helloWorld.py

#!/usr/bin/python

import wx

class MainWindow(wx.Frame):
         """ We simply derive a new class of Frame. """
         def __init__(self, parent, id, title):
                 wx.Frame.__init__(self, parent, wx.ID_ANY, title, 
size=(200,100),
 
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
                 self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
                 self.Show(True)

app = wx.PySimpleApp()
frame = MainWindow(None, -1, 'Small editor')
app.MainLoop()


I'm sure it's something simple I'm overlooking, so I'll go get a cup of 
coffee and see if someone with better eyes spots my error.

thanks,
Matt


-- 
Matt Richardson
IT Consultant
College of Arts and Letters
CSU San Bernardino
(909)537-7598

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to