You are not logged in.
Pages: 1
i was learning how to make a gui with wxpython from a tutorial now this is a simple program how do i run this code to produce the dialog box??
thats what im suppose to see according to the tutorial
#!/usr/bin/python
# simple.py
import wx
app = wx.App()
frame = wx.Frame(None, -1, 'simple.py')
frame.Show()
app.MainLoop()
if some one could help would be appreciated anyhow thanks
Last edited by okplayer02 (2008-12-24 11:48:56)
Say what is good or keep silent --Prophet Muhammad (SAW)
Offline
It seems like you should read up on the Python tutorial [1], especially the part about running scripts [2].
Basically, add those lines to a file (test.py), then do:
python test.py
[1] - http://docs.python.org/tutorial
[2] - http://docs.python.org/tutorial/interpr … on-scripts
Offline
thanks for that i dabbled a lil with python before seems like a very good language to get involved with. very flexible
Say what is good or keep silent --Prophet Muhammad (SAW)
Offline
Your program says it's name is "simple.py" , so if you saved it as simple.py you can run it 2 different ways. You can run the program as stated above by
python simple.py
or you can make the program executeable
chmod a+x simple.py
then you can run it with
./simple.py
notice period in front of the slash......... even the link above tom5760 posted doesn't really spell it out for a newbie, and was the same exact first question I asked, so don't feel to bad about asking it.
Offline
....
chmod a+x simple.py
then you can run it with
./simple.py
...
Yes, good point to mention.
An important thing to realize when you do that, bash will use whatever is after the #! at the top of the file.
In your example, you have:
#!/usr/bin/python
Therefore, bash will take that script (with executable permission), and run it through python.
You will probably see other scripts that have stuff like:
#!/bin/bash
Which will run the script through bash.
The #! is usually called the shebang.
Offline
Pages: 1