Tue 31 Aug 2010
This is the last article of my “Build a Binary Series”. If you haven’t done so already, be sure to check out the others. For our finale, we are to look at Andrea Gavana’s wxPython-based GUI2Exe, a nice graphical user interface to py2exe, bbfreeze, cx_Freeze, PyInstaller and py2app. The latest release of GUI2Exe is 0.5.0, although the source may be slightly newer. Feel free to run from the tip as well. We’ll be using the example scripts that we used for several of the previous articles: one console and one GUI script, neither of which do much of anything.
Getting Started with GUI2Exe
Quite some time ago, I wrote another article on this cool tool. However, the look-and-feel of the application has changed quite a bit, so I felt I should re-write that article in the context of this series. To follow along with this article, you’ll need to hit Google Code for the source. Let’s begin, shall we? Here are some step-by-step directions for making the console script using py2exe via GUI2Exe:
- Download the source and unzip them in a convenient location
- Run the “GUI2Exe.py” file (you can use your favorite editor, open it via the command line or whatever)
- Go to File, New Project. A dialog will appear asking you to name the project. Give it a good name! Then hit OK.
- Click in the “Exe Kind” column and change it to “Console”
- Click in the “Python Main Script” column and you’ll see a button appear.
- Press the button and use the file dialog to find your main script
- Fill out the other optional fields however you like
- Hit the compile button on the lower right
- Try the result to see if it worked!
If you followed the directions above, you should now have an executable file (and a few dependencies) in a “dist” folder at the location of the main script. As you can see in the screenshot above, there are all the typical options that you would set in your setup.py file. You can set your excludes list, the includes, the optimize and compressed settings, whether or not to include a zip, packages and much more! You can tweak to your hearts content and hit the “Compile” button whenever you’re ready to see the result. If I’m experimenting, I usually change the output directory’s name so I can compare the results to see which is the most compact.
If you want to use bbfreeze, cx_freeze, PyInstaller or py2app, just click the respective name in the column on the right. This will cause the middle part of the screen to change according to your choice and show the corresponding options for said choice. Let’s take a quick visual tour!
GUI2Exe in Pictures!
The following is a snapshot of the py2app options:
Next is a shot of the cx_Freeze options:
And here is PyInstaller’s settings:
Finally, we have bbfreeze’s options:
There’s also a VendorId screen, but I don’t know much about that one, so we’ll be skipping it.
GUI2Exe’s Menu Options
As you might guess, all these options work the same way as they do when you do it all yourself in code. If you ever need to check out the setup.py file that GUI2Exe is making for you, just go to the Builds menu and choose View Setup Script. If you want to see a handy listing of the files it output and where it output the files, go to Build, Explorer and you should see something like the screenshot below:
Other handy option in the Builds menu include the Mission Modules and the Binary Dependencies menu items. These show you what may be missing from the dist folder that you may need to include should you distribute your masterpiece.
The Options menu controls options for GUI2Exe itself and a few custom items for the build process, like setting the Python version, deleting the build and/or dist folders, set the PyInstaller Path and more. The other menus are pretty self-explanatory and I leave them for the adventurous readers.
If you’ve read my other tutorials in the “Build a Binary Series” then you should be able to take that knowledge and use it productively with GUI2Exe. I find GUI2Exe to be very helpful when it comes time for me to build an executable and I used it to help me figure out the options for some of the other binary builders in this series. I hope you enjoyed this series and found it helpful. See you next time!