Launching wxPython from Linux?

Hello all,

I’m starting to get more requests from clients to do some small to medium-sized Python projects. My skill level with Python has been small but I now have a reason to bring my skill level up. I’ve installed wxPython on my Linux laptop but I can’t seem to figure out how to launch it. Is it possible that it is named something other than wxPython? I’ve researched this issue for a couple of days online but just haven’t found an answer.

Thanks for any help you can give.

-Chad McCullough

Hello,

wxPython is a library for use in Python scripts. So you need a python scrip that uses it.

i.e) simple hello.py script using wxPython

import wx # ← wxPython

app = wx.App(False)

wx.MessageBox(“Hello from wxPython” “Hello World”)

app.MainLoop()

You can then run this from the command line: python hello.py

···

On Thu, Sep 11, 2008 at 9:28 AM, Chad McCullough cm1967@gmail.com wrote:

Hello all,

I’m starting to get more requests from clients to do some small to medium-sized Python projects. My skill level with Python has been small but I now have a reason to bring my skill level up. I’ve installed wxPython on my Linux laptop but I can’t seem to figure out how to launch it. Is it possible that it is named something other than wxPython? I’ve researched this issue for a couple of days online but just haven’t found an answer.

Thanks for any help you can give.

-Chad McCullough


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

aaaahhhhh…now I get it.

Thanks for your help!

···

On Thu, Sep 11, 2008 at 10:34 AM, Cody Precord codyprecord@gmail.com wrote:

Hello,

wxPython is a library for use in Python scripts. So you need a python scrip that uses it.

i.e) simple hello.py script using wxPython

import wx # ← wxPython

app = wx.App(False)

wx.MessageBox(“Hello from wxPython” “Hello World”)

app.MainLoop()

You can then run this from the command line: python hello.py

On Thu, Sep 11, 2008 at 9:28 AM, Chad McCullough cm1967@gmail.com wrote:

Hello all,

I’m starting to get more requests from clients to do some small to medium-sized Python projects. My skill level with Python has been small but I now have a reason to bring my skill level up. I’ve installed wxPython on my Linux laptop but I can’t seem to figure out how to launch it. Is it possible that it is named something other than wxPython? I’ve researched this issue for a couple of days online but just haven’t found an answer.

Thanks for any help you can give.

-Chad McCullough


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Also note: in Unix, you can make text files (scripts) executable. You
specify the interpreter to use on the first (bang) line. Thus, many
python scripts will start with

#!/usr/bin/env python

Which tells your shell to use the '/usr/bin/env' program to find the
'python' executable (in your PATH) and run it with this script file as
input.

Example
----- file: foo
#!/usr/bin/env python
print 'Hello from Python'
----- end: foo

% chmod +x foo
% ./foo
Hello from Python

For reference: you can do a similar thing in recent versions of
windows, with batch files:

------ file: foo.bat
@setlocal enableextensions & python -x %~f0 & goto :EOF
print 'The rest of his file is executable Python code!'
----- end: foo.bat

c:\> foo
The rest of his file is executable Python code!

Foo.bat could, of course, also import and use wx.

- Kevin

···

On Thu, Sep 11, 2008 at 7:47 AM, Chad McCullough <cm1967@gmail.com> wrote:

aaaahhhhh......now I get it.

Thanks for your help!

On Thu, Sep 11, 2008 at 10:34 AM, Cody Precord <codyprecord@gmail.com> > wrote:

Hello,

wxPython is a library for use in Python scripts. So you need a python
scrip that uses it.

i.e) simple `hello.py` script using wxPython

import wx # <- wxPython

app = wx.App(False)
wx.MessageBox("Hello from wxPython" "Hello World")
app.MainLoop()

You can then run this from the command line: python hello.py

On Thu, Sep 11, 2008 at 9:28 AM, Chad McCullough <cm1967@gmail.com> wrote:

Hello all,

I'm starting to get more requests from clients to do some small to
medium-sized Python projects. My skill level with Python has been small but
I now have a reason to bring my skill level up. I've installed wxPython on
my Linux laptop but I can't seem to figure out how to launch it. Is it
possible that it is named something other than wxPython? I've researched
this issue for a couple of days online but just haven't found an answer.

Thanks for any help you can give.

-Chad McCullough

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Kevin Grover wrote:

For reference: you can do a similar thing in recent versions of
windows, with batch files:

------ file: foo.bat
@setlocal enableextensions & python -x %~f0 & goto :EOF
print 'The rest of his file is executable Python code!'
----- end: foo.bat

VERY COOL! I've been looking for that for years! I had no idea.

Thanks,
-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (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

Christopher Barker wrote:

<div class="moz-text-flowed" style="font-family: -moz-fixed">Kevin
Grover wrote:

For reference: you can do a similar thing in recent versions of
windows, with batch files:

------ file: foo.bat
@setlocal enableextensions & python -x %~f0 & goto :EOF
print 'The rest of his file is executable Python code!'
----- end: foo.bat

VERY COOL! I've been looking for that for years! I had no idea.

Surely the much easier and cleaner solution is this:
    set PATHEXT=%PATHEXT%;.py;.pyw

That adds py and pyw to the list of extensions that will be searched
when looking for an executable. So, if you have a file called "foo.py"
in your path, you can type:
    foo
and it will be executed using the default handler for .py files, which
is the Python interpreter.

The foo.bat solution was created for Windows 9X, which did not support
PATHEXT.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Yes, that's actually what I use. I seem to remember that there are
redirection issues with batch files, but the details escape me at the
moment.

···

On Fri, Sep 12, 2008 at 10:06 AM, Tim Roberts <timr@probo.com> wrote:

Christopher Barker wrote:

<div class="moz-text-flowed" style="font-family: -moz-fixed">Kevin
Grover wrote:

For reference: you can do a similar thing in recent versions of
windows, with batch files:

------ file: foo.bat
@setlocal enableextensions & python -x %~f0 & goto :EOF
print 'The rest of his file is executable Python code!'
----- end: foo.bat

VERY COOL! I've been looking for that for years! I had no idea.

Surely the much easier and cleaner solution is this:
   set PATHEXT=%PATHEXT%;.py;.pyw

That adds py and pyw to the list of extensions that will be searched
when looking for an executable. So, if you have a file called "foo.py"
in your path, you can type:
   foo
and it will be executed using the default handler for .py files, which
is the Python interpreter.