Search code examples
windowswxpythoncx-freeze

Running a wxPython application in a Windows environment w/o the command prompt displaying


I developed an application with wxPython and used cx_freeze to covert it to a .exe. I installed the app on WinXP and it works fine. My only misgiving is that the GUI app is running with a command prompt behind it. How can I get rid of this command prompt? I imagine that it is there to display errors etc… There must be a way to redirect errors to a log file instead of showing this command prompt? Thanks in advance.


Solution

  • See How can I hide the console window when freezing wxPython applications with cxFreeze?

    I also wrote this which has one solution:

    http://www.blog.pythonlibrary.org/2010/08/12/a-cx_freeze-tutorial-build-a-binary-series/

    The key part is near the end of the article:

    from cx_Freeze import setup, Executable
    
    exe = Executable(
        script="sampleApp.pyw",
        base="Win32GUI",
        )
    
    setup(
        name = "wxSampleApp",
        version = "0.1",
        description = "An example wxPython script",
        executables = [exe]
        )
    

    You need the bit that says this: base="Win32GUI"

    Then it should work.