Python on Win32: How to freeze? How to hide the system console?

David Bolen db3l at fitlinxx.com
Fri Jul 21 14:46:42 EDT 2000


"Franz GEIGER" <fgeiger at datec.at> writes:

> New to Python I have 2 q's:
> 
> 1) Does anybody "freeze" his Python scripts dev'ed on and for Windows
> machines? How? Is Tkinter code freezed too? What's the result? A single EXE
> file?

I don't do freezes myself, but if you're just trying to come up with a
clean distribution mechanism there are some other alternatives.  The
one I prefer is using an installer package from Gordon McMillan:

	http://www.mcmillan-inc.com/install1.html

This automatically tracks down the various dependencies of your script
and puts it all together (along with some very nice archive formats
for the various library routines) into an executable that
self-extracts itself when it runs.  You generally end up with the exe,
a pyz for python library files a few standlone files (like
exceptions.pyc) and any external modules (dll/pyd).  That collection
of files is all you need to run your application.

The installer package has a simple installation script (console based
- prompts for a directory and unpacks), but you can combine the
installer with a Windows installation package (on the free side, for
example, Inno Setup:

	http://www.jrsoftware.org

and you end up with your Python application looking just like a native
installed Windows application, and being totally self-contained within
its installation directory.  Users install/uninstall it just like any
other Windows application.

> 2) How can I hide the system console on a Windows machine running a Python
> script using Tkinter?

Use pythonw rather than python to start your script.

(If using the installer package, it has a configuration file option to
use a "runw" module to start the script rather than "run" for the same
purpose).

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list