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.
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:
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!
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.
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!
Copyright © 2024 Mouse Vs Python | Powered by Pythonlibrary