You are not logged in.

#1 2008-12-23 22:25:45

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

wxPython help (SOLVED)

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

#2 2008-12-23 22:36:19

tom5760
Member
From: Philadelphia, PA, USA
Registered: 2006-02-05
Posts: 283
Website

Re: wxPython help (SOLVED)

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

#3 2008-12-23 22:46:18

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

Re: wxPython help (SOLVED)

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

#4 2008-12-24 02:07:05

crouse
Arch Linux f@h Team Member
From: Iowa - USA
Registered: 2006-08-19
Posts: 907
Website

Re: wxPython help (SOLVED)

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

#5 2008-12-24 03:46:03

tom5760
Member
From: Philadelphia, PA, USA
Registered: 2006-02-05
Posts: 283
Website

Re: wxPython help (SOLVED)

crouse wrote:

....
chmod a+x simple.py
then you can run it with
./simple.py
...

Yes, good point to mention. smile

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

Board footer

Powered by FluxBB