My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 21, 2008 by andrea.gavana
Labels: Featured
GUI2ExeExamples  

GUI2Exe Examples

Introduction

Hereafter I show a couple of examples on how to use GUI2Exe.

Simple one

We will build the sample file that comes with py2exe, on:

/site-packages/py2exe/sample/singlefile/gui/test_wx.py

  1. With the GUI opened, hit Ctrl+N or choose File => New project... ;
  2. Enter a name for the new project, i.e. "pyexe sample file";
  3. In the central window that appears, under the Target Class box, right click on the list control and select "Add item(s)";
  4. Left click on the new item in Exe Kind column and select "windows";
  5. Left click on the new item in the Python Main Script column and browse to search for the aforementioned file;
  6. On the Optimize, Compressed and Bundle Files drop down choices, choose 2, 2, 1 respectively;
  7. Scroll down the central window to the bottom and check the XP Manifest File option;
  8. Click on the Compile button.

And you're done. You can follow the compilation steps in the bottom log window as py2exe builds your executable.


Less simpler one

We will build the wxPython demo as executable, using py2exe.

  1. With the GUI opened, hit Ctrl+N or choose File => New project... ;
  2. Enter a name for the new project, i.e. "wxPython demo";
  3. In the central window that appears, under the Target Class box, right click on the list control and select "Add item(s)";
  4. Left click on the new item in Exe Kind column and select "windows";
  5. Left click on the new item in the Python Main Script column and browse to search for the file /YourPathToTheDemo/demo/Main.py;
  6. On the Optimize, Compressed and Bundle Files drop down choices, choose 2, 2, 1 respectively;
  7. Check the Dist Directory checkbox and write a new name for the distribution directory in the text box below (i.e., "py2exe");
  8. On the Packages list, hit Ctrl+A twice and edit the items to be wx and wx.lib respectively;
  9. On the Data Files list, hit Ctrl+A, browse with the file dialog to /YourPathToTheDemo/demo/bitmaps and select all the files. Do the same thing for the folders bmp_source and data.
  10. On the Data Files list, hit Ctrl+A, browse with the file dialog to /YourPathToTheDemo/demo and select all the files. In the dialog which will appear next simply write "." (a dot);
  11. Scroll down the central window to the bottom and check the XP Manifest File option;
  12. Click on the Compile button.

And you're done. You can follow the compilation steps in the bottom log window as py2exe builds your executable.


Comment by v...@it.uu.se, Jul 27, 2009

I have tried your second example with Python 2.6.2, wxPython 2.8.10.1 (msw-ansi), and py2exe 0.6.9 on a Windows Vista platform. I wrote a rather simple program that used wxPython and tried to create a executable that I could use on a Windows Vista platform. However, I get a warning/error during the compilation process:

C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning?: the sets module is deprecated

import sets

How do I fix this problem?

Thank you, --V. P. Stokes


Sign in to add a comment
Hosted by Google Code