Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

A minimal template for creating a wxPython GUI application and compiling it into an *.app (for OS X) / *.exe (for MS Windows) with py2app, py2exe, cx_freeze and PyInstaller.

License

Notifications You must be signed in to change notification settings

geberl/wxpython-freezing-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wxPython Freezing Template

This is a basic template for creating Python applications that use wxPython.

The Python code of the graphical user interface in gui.py is generated by wxFormBuilder (3.5.0 beta). The editable project file is gui.fbp. Modify this file with WxFormbuilder and select File, Generate code afterwards.

Screenshot of Py2app Wx Template on OS X 10.10.2

Apart from creating new applications I use this template for testing parts of my code that seem problematic when trying to freeze the Python code to an executable with py2app, py2exe, PyInstaller or cx_freeze. Using Nuitka is another possibility to get an executable but requires a C++ compiler to be installed on your system. Nuitka is not added here as of now.

The actual OS X *.app and Windows *.exe are not included here. The program doesn't do anything. The whole purpose is to create it yourself. The OS X .app is about 66MB in size, its Windows counterpart ranges from 6.9MB (PyInstaller --onefile with UPX) to 22.1MB (py2exe).

Commands

Running the program through the Python interpreter on OS X

cd ~/Development/wxpython_freezing_template
/usr/local/Cellar/python/2.7.8_1/bin/python main.py

Running the program through the Python interpreter on Windows

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe main.py

Py2app

Links

Commands

Freezing

cd ~/Development/wxpython_freezing_template
/usr/local/Cellar/python/2.7.8_1/bin/python setup_py2applet.py py2app --iconfile=icon.icns

Running the frozen main.app

cd ~/Development/wxpython_freezing_template
open ./dist/main.app

Cleaning up

cd ~/Development/wxpython_freezing_template
rm -r build
rm -r dist

Py2exe

Links

Commands

Freezing

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe setup_py2exe.py py2exe

Running the frozen main.exe

C:\pycharm_projects\wxpython_freezing_template\dist\main.exe

Cleaning up

rd C:\pycharm_projects\wxpython_freezing_template\build /s /q
rd C:\pycharm_projects\wxpython_freezing_template\dist /s /q

PyInstaller

Links

Commands

Creating a very basic specfile for freezing

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe C:\Python27\Scripts\pyi-makespec-script.py --windowed --icon=icon.ico --onefile --version-file=setup_pyinstaller_version.txt main.py

Freezing by using a specfile

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe C:\Python27\Scripts\pyinstaller-script.py --clean --upx-dir=C:\upx\ setup_pyinstaller_onedir.spec

Running the frozen main.exe

C:\pycharm_projects\wxpython_freezing_template\dist\main\main.exe

Optional steps for freezing to one *.exe file afterwards, directly creating one single *.exe seems to be not possible.

cd C:\pycharm_projects\wxpython_freezing_template
xcopy dist\main\main.exe.manifest dist
xcopy dist\main\icon.ico dist
xcopy dist\main\logging_to_file.ini dist
xcopy dist\main\logging_to_terminal.ini dist
xcopy dist\main\logging_to_terminal_and_file.ini dist
rd C:\pycharm_projects\wxpython_freezing_template\build /s /q
rd C:\pycharm_projects\wxpython_freezing_template\dist\main /s /q
C:\Python27\python.exe  C:\Python27\Scripts\pyinstaller-script.py --clean --upx-dir=C:\upx\ setup_pyinstaller_onefile.spec

Running the frozen one file main.exe

C:\pycharm_projects\wxpython_freezing_template\dist\main.exe

Cleaning up

rd C:\pycharm_projects\wxpython_freezing_template\build /s /q
rd C:\pycharm_projects\wxpython_freezing_template\dist /s /q

cx_Freeze

Links

Commands

Generating a very basic distutils setup script

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe C:\Python27\Scripts\cxfreeze-quickstart.py

Freezing by using a setup script

cd C:\pycharm_projects\wxpython_freezing_template
C:\Python27\python.exe setup_cx_freeze.py build

Running the frozen main.exe

C:\pycharm_projects\wxpython_freezing_template\build\exe.win32-2.7\main.exe

Cleaning up

rd C:\pycharm_projects\wxpython_freezing_template\build /s /q

Sources

About

A minimal template for creating a wxPython GUI application and compiling it into an *.app (for OS X) / *.exe (for MS Windows) with py2app, py2exe, cx_freeze and PyInstaller.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages