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

后端 未结 4 1039
执念已碎
执念已碎 2020-12-12 21:23

I\'m developing a Python application using wxPython and freezing it using cxFreeze. All seems to be going fine apart from this following bit:

When I run the executab

4条回答
  •  自闭症患者
    2020-12-12 21:41

    This worked to some extent but it has issues. My program runs in both a console mode and a GUI mode. When run from the console with a --console argument it runs in a console mode. When I followed the procedure below, this doesn't work anymore and my program is only a GUI app then.

    The following source code comes from a sample file in the \Python\Lib\site-packages\cx_Freeze\samples\PyQt4\setup.py. Lesson of the day. Read the README.

    # A simple setup script to create an executable using PyQt4. This also
    # demonstrates the method for creating a Windows executable that does not have
    # an associated console.
    #
    # PyQt4app.py is a very simple type of PyQt4 application
    #
    # Run the build process by running the command 'python setup.py build'
    #
    # If everything works well you should find a subdirectory in the build
    # subdirectory that contains the files needed to run the application
    
    import sys
    
    from cx_Freeze import setup, Executable
    
    base = None
    if sys.platform == "win32":
        base = "Win32GUI"
    
    setup(
            name = "simple_PyQt4",
            version = "0.1",
            description = "Sample cx_Freeze PyQt4 script",
            executables = [Executable("PyQt4app.py", base = base)])
    

提交回复
热议问题