Unix-head needs to Windows-ize his Python script (II)
gb345 at invalid.com
Fri Oct 22 16:25:22 CEST 2010
In <i9n9ed$q03$1 at reader1.panix.com> gb345 <gb345 at invalid.com> writes:
>I have a handy Python script, which takes a few command-line
>arguments, and accepts a few options. I developed it on Unix, with
>very much of a Unix-mindset. Some Windows-using colleagues have
>asked me to make the script "easy to use under Windows 7". I.e.:
>Therefore, I want to adapt my script, with the minimum amount of
>work, so that it can have a double-clickable icon that brings up
>a small GUI to accept command-line options (including a couple of
>file-selectors for input and output files).
>I am Windows-illiterate, so I really would like to keep this as
>barebones as possible. Where should I look to learn more about
>how to do this?
>(P.S. in case it matters, it's OK to assume that Python will be
>installed on the Windows system; IOW, the script need not bring
>with it a Python interpreter and libraries.)
Thank you all for your comments and suggestions. Here's where I
1. I first implemented a GUI using wx, but later (after reading on
of your comments)...
2. ...I re-implemented the GUI using Tkinter; (FWIW: the wx version
was infinitely easier to write, and looks much nicer too; I hope
that wx will be added to the standard library at some point);
3. Both versions of the app work fine on Windows 7, as long as
I do the following:
a. run CMD
b. cd to where the GUI script and my original script live
c. execute either
So far so good. Still missing from my goal is a clickable app that
obviates the need to do the cumbersome (for the Windows-head) steps
listed under #3.
One possibility would be to use a "batch file" script to do the
stuff in #3, but the problem is that this script would have to know
the location of the GUI script and the original script. I think
it would be too much to ask the user of this little app to edit
the batch script to make sure these paths are correct.
As far as I can tell, the only alternative left is to plunge into
I've looked into it, and I agree that it's not for the fainthearted.
I'd appreciate some clues for my setup.py.
My original script (I'll call it myscript.py) imports the following
sys, os, platform, csv, re, logging, collections, optparse
My tk-based GUI script (I'll call it myapp_tk.py) imports the
following standard modules:
sys, re, Tkinter, tkFileDialog
...plus, crucially, it imports the original script, myscript.py.
For completeness I'll also mention that my wx-based GUI script
os, re, wx, and myscript
Question: how do I call the setup function (within setup.py) so
that the the GUI script can find myscript.py when the app's icon
As I said, I much prefer the wx version of the GUI over the tk
version of my app. If I'm going to the trouble of making an exe
version of the app, it would make sense to do it for the wx version
rather than the tk version. How would I need to modify the call
to setup() so that the required wx libraries are included in the
More information about the Python-list