How do I make Windows Application with Python ?

Rob Emmons rmemmons at member.fsf.org
Mon Jan 3 20:56:10 EST 2005


> Well, I programmed a little in MS Visual Studio 2003, and there you have
> Console apllication and Windows application (among others). Windows one is
> with buttons and other gadgets. So, I want to make applications that
> doesn't open console to display result, I want to display it into the
> message box. Also, I want to use that application on the computers where
> Python isn't installed

First there is a good book:  Python Prgoramming on Win32,  by Hammond &
Robinson, O'Reilly is the publisher.  I believe one of these guys wrote
the python windows extension.

Second, on MS Windows you need two python installs, the basic python install,
and the python for windows extension (also sometimes call win32all or
something like that).  These two together give you a great basic set to
work with.  I've done MS Windows programming with these and they work great.

With the win32 extension module -- you can use ActiveX, you can use the
standard MS Windows calls, and it also defines a python intepretor mode
where it does not open the console window if you name the main program
module as .pyw (as opposed to .py).  It does other things too.  This is
all discribed in the book I recommended.  Note also, if you don't want to
see the console window -- even without use .pyw files, you can tell the
launcher to open the console window minimized -- not great but it does
work.

I believe also if you want to use MS Visual Studio -- Active State sells
python programming tools that plug into MS Visual Studio if you want to do
that.  I've not tried these so I don't know how they work or if they are
any good.

It's also possible to program on MS Windows so your app is protable to Linux
and other systems.  You can use Tkinter or wxWidgets (was called
wxWindows -- until maybe MS made them change it) to do that.  I've 
used Tkinter before for example, though I think wxWidgets is probalby 
more of the wave of the future.  Others may know.

If you want to run the program on other computers not having python, you
have two basic choices.  One -- what I do, I just made up a python setup
CD that installs python, python windows extensions, and the basic
libraries I usually use so that it's easy to setup a python environment on
other systems.  Then I install my code.

The other alternative is to use one of the tools that wraps up a python
program with the needed executables.  Some of these are py2exe, cx-freeze,
McMillan Installer, Fractel Mountains, StarKits, UPX, and InnoSetup. I've
not used any of these -- and so this list may not be correct/complete. 
Others may know what's best.

There are also some compilers too - pyrex, pysco starkiller, and pypy. 
Again, I've not used any of these and this is just from some cryptic notes
I've taken.  So ask others for input.  Probabably you want one of the 
installers rather than the compilers because python compilers are kind of 
new, but that's just a guess.

Hope that helps.
Rob



More information about the Python-list mailing list