Newbie question

Howdy,

   I really hate to bother everyone with such a simple
problem - so my apologies up front.
   I'm starting to learn wxPython and I went to this URL
to start learning:

http://wiki.wxpython.org/index.cgi/Getting_20Started#head-bc009992ceb90dddb7eb3db953e25d1792da2cdd

I can't get even the first script to run and display a window
(I'm using 2.6.1 of wxPython on a CentOS 4.1 machine).
I can run the examples from the OSCon 2004 beginners
presentation, but not this one. All I get is a set of cross-hairs
(the cursor changes to a set of cross-hairs) and then nothing.
Is the beginners section of wiki up to date? Or did I screw
something up?

Thanks!

Jeff

Jeffrey B. Layton wrote:

Howdy,

  I really hate to bother everyone with such a simple
problem - so my apologies up front.
  I'm starting to learn wxPython and I went to this URL
to start learning:

http://wiki.wxpython.org/index.cgi/Getting_20Started#head-bc009992ceb90dddb7eb3db953e25d1792da2cdd

I can't get even the first script to run and display a window
(I'm using 2.6.1 of wxPython on a CentOS 4.1 machine).
I can run the examples from the OSCon 2004 beginners
presentation, but not this one. All I get is a set of cross-hairs
(the cursor changes to a set of cross-hairs) and then nothing.
Is the beginners section of wiki up to date? Or did I screw
something up?

Please post the code you are trying to run. Perhaps you did something wrong with the copy/paste from the wiki, and one of us can spot it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Jeffrey B. Layton wrote:

Howdy,

  I really hate to bother everyone with such a simple
problem - so my apologies up front.
  I'm starting to learn wxPython and I went to this URL
to start learning:

http://wiki.wxpython.org/index.cgi/Getting_20Started#head-bc009992ceb90dddb7eb3db953e25d1792da2cdd

I can't get even the first script to run and display a window
(I'm using 2.6.1 of wxPython on a CentOS 4.1 machine).
I can run the examples from the OSCon 2004 beginners
presentation, but not this one. All I get is a set of cross-hairs
(the cursor changes to a set of cross-hairs) and then nothing.
Is the beginners section of wiki up to date? Or did I screw
something up?

Please post the code you are trying to run. Perhaps you did something wrong with the copy/paste from the wiki, and one of us can spot it.

Sorry, I should have done that in the first place.

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

Thanks!

Jeff

Jeffrey B. Layton wrote:

Jeffrey B. Layton wrote:

Howdy,

  I really hate to bother everyone with such a simple
problem - so my apologies up front.
  I'm starting to learn wxPython and I went to this URL
to start learning:

http://wiki.wxpython.org/index.cgi/Getting_20Started#head-bc009992ceb90dddb7eb3db953e25d1792da2cdd

I can't get even the first script to run and display a window
(I'm using 2.6.1 of wxPython on a CentOS 4.1 machine).
I can run the examples from the OSCon 2004 beginners
presentation, but not this one. All I get is a set of cross-hairs
(the cursor changes to a set of cross-hairs) and then nothing.
Is the beginners section of wiki up to date? Or did I screw
something up?

Please post the code you are trying to run. Perhaps you did something wrong with the copy/paste from the wiki, and one of us can spot it.

Sorry, I should have done that in the first place.

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

Well, there's not much that can go wrong with that one, and it does work here. Do you get any messages printed to the console where you run the script from?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Jeffrey B. Layton wrote:

Please post the code you are trying to run. Perhaps you did something wrong with the copy/paste from the wiki, and one of us can spot it.

Sorry, I should have done that in the first place.

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

Well, there's not much that can go wrong with that one, and it does work here. Do you get any messages printed to the console where you run the script from?

Well, the cursor changes to cross-hairs. So I assume it's looking
for input, so I click a couple of times and I get this:

./new_test1.py: line 4: syntax error near unexpected token `('
./new_test1.py: line 4: `app = wx.PySimpleApp()'

Beats me.

Jeff

How are you running the code?

eg - 'python new_test1.py' from the command line? '#!/usr/bin/python'
in the first line of the script? Or are you using IDLE?

···

On 15/02/06, Jeffrey B. Layton <laytonjb@charter.net> wrote:

>> import wx
>> app = wx.PySimpleApp()
>> frame = wx.Frame(None, -1, "Hello World")
>> frame.Show(1)
>> app.MainLoop()
>
>
Well, the cursor changes to cross-hairs. So I assume it's looking
for input, so I click a couple of times and I get this:

./new_test1.py: line 4: syntax error near unexpected token `('
./new_test1.py: line 4: `app = wx.PySimpleApp()'

--
John.

Well, the cursor changes to cross-hairs. So I assume it's looking
for input, so I click a couple of times and I get this:

./new_test1.py: line 4: syntax error near unexpected token `('
./new_test1.py: line 4: `app = wx.PySimpleApp()'

That looks like you're running it as a script under *nix:

./new_test1.py

For that to work, you need to have the right #! line as the first line of the file:

#!/usr/bin/env python

There are others that work, but that's pretty universal.

alternatively, you can explicitly call python:

python new_test1.py

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

John Fouhy wrote:

···

On 15/02/06, Jeffrey B. Layton <laytonjb@charter.net> wrote:

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

Well, the cursor changes to cross-hairs. So I assume it's looking
for input, so I click a couple of times and I get this:

./new_test1.py: line 4: syntax error near unexpected token `('
./new_test1.py: line 4: `app = wx.PySimpleApp()'
   
How are you running the code?

eg - 'python new_test1.py' from the command line? '#!/usr/bin/python'
in the first line of the script? Or are you using IDLE?

Oh God... Talk about a major Brain-Freeze. I've only been coding
Python for almost 4 years now. Talk about an absolutely stupid
mistake!!!

Thanks!

Jeff