Hide console window with Tkinter and cx_Freeze

后端 未结 7 1649
南方客
南方客 2020-12-03 03:52

I am using cx_freeze to freeze a tkinter app. When I run the exe I get a wonderfully USELESS console window along with my tkinter GUI.

I would like to remove

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 04:44

    I had the same problem today

    What i was using to compile my python programs was py2exe and the fix was very simple modify the setup file as shown below. My interface is written with Tkinter

    modify the "setup.py" py2exe script from:

    Old Python Code:

    from distutils.core import setup
    import py2exe
    setup(console=['app.py'])
    

    New Python Code:

    from distutils.core import setup
    import py2exe
    setup(windows=['app.py'])
    

    After i did this and reran my setup script the application loaded and did not show the console window. The only thing with this is if you have your application sending print commands to the console window you will not see theme. I hope this helps.

提交回复
热议问题