Your browser does not support JavaScript!
Upvotes Anonymous 1 User 0

How to Build a Windows Executable from the CEFPython WxPython Example

It is possible to create a Windows executable for the wxPython example that comes with CEFPython. Below are some steps I took to build the executable.

1. Create a Python script to indicate the necessary py2exe dependencies. I named the file build_exe.py:
from distutils.core import setup
import py2exe
from cefpython3 import cefpython
import wx
import time
import re
import uuid
import platform
import inspect
import struct
import urllib
setup(
    windows=['wxpython.py']
    #options={'py2exe': {'bundle_files': 1}},
    #zipfile = None
)
2. Create a .bat file to run the commands. I named this build_exe.bat:
set PYTHONPATH=C:\Python27;C:\Python27\Lib;C:\Python27\DLLs
C:\Python27\python.exe build_exe.py py2exe
pause
3. I commented out this line in wxpython.py:
jsBindings.SetProperty("sources", GetSources())
because this functionality wants to introspect and send Python source to the JavaScript side (but we're running from an .exe).

I made some other slight modifications, which can be viewed in the source:

Download source
Was this helpful?

Tags

Comments

Leave a Comment

I agree to the Terms of Service
Design © 2015, Downranked, LLC.,
Original user code contributions under MIT License