title: How should I launch a Portable Python Tkinter application on Windows without ugliness?
body: <p>I've written a simple GUI program in python using Tkinter. Let's call this program 'gui.py'. My users run 'gui.py' on Windows machines from a USB key using <a href="http://www.portablepython.com/" rel="nofollow noreferrer">Portable Python</a>; installing anything on the host machine is undesirable.</p>
  
  <p>I'd like my users to run 'gui.py' by double-clicking an icon at the root of the USB key. My users don't care what python is, and they don't want to use a command prompt if they don't have to. I don't want them to have to care what drive letter the USB key is assigned. I'd like this to work on XP, Vista, and 7.</p>
  
  <p>My first ugly solution was to create a shortcut in the root directory of the USB key, and set the "Target" property of the shortcut to something like "(root)\App\pythonw.exe (root)\App\gui.py", but I couldn't figure out how to do a relative path in a windows shortcut, and using an absolute path like "E:" seems fragile.</p>
  
  <p>My next solution was to create a .bat script in the root directory of the USB key, something like this:</p>
  
  <pre><code>@echo off
  set basepath=%~dp0
  "%basepath%App\pythonw.exe" "%basepath%\App\gui.py"
  </code></pre>
  
  <p>This doesn't seem to care what drive letter the USB key is assigned, but it does leave a DOS window open while my program runs. Functional, but ugly.</p>
  
  <p>Next I tried a .bat script like this:</p>
  
  <pre><code>@echo off
  set basepath=%~dp0
  start "" "%basepath%App\pythonw.exe" "%basepath%\App\gui.py"
  </code></pre>
  
  <p>(See <a href="https://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program/154090#154090">here</a> for an explanation of the funny quoting)</p>
  
  <p>Now, the DOS window briefly flashes on screen before my GUI opens. Less ugly! Still ugly.</p>
  
  <p>How do real men deal with this problem? What's the least ugly way to start a python Tkinter GUI on a Windows machine from a USB stick?</p>
  
  <p>EDIT:
  All the answers below were very good (py2exe, pyinstaller, small .exe, .wsf script.) The .wsf solution was the simplest, so I'm using it for now. I'll probably end up switching to one of the other three solutions if I want a prettier icon and the standard .exe extension. Thanks, everyone!</p>