Giter Site home page Giter Site logo

barbul / wxpython_freezing_template Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 204 KB

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: GNU General Public License v2.0

Python 100.00%

wxpython_freezing_template's Introduction

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

wxpython_freezing_template's People

Contributors

geberl avatar

Stargazers

Faraz Oloumi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.