Search code examples
python-3.xpyqt4console-applicationcx-freeze

Close open console after PyQt4 GUI close


I have created an exe of a python program with cx_Freeze.
I have used PyQt4 to create a GUI.

It opens perfectly, an empty console first and then the GUI.
However when I close the GUI (after running the program or not) the console remains open. If I click on any part of the console it gives me the error popup "MyProgram has stopped working"

This has been tested on a system (Win7-64bit) with a python install (3.4.4) and another system with no python (Win7-64bit).

Is there a way that I can close this console after the GUI is closed? or better yet...How do I close the console?

DevEnv
Python : 3.4
OS : Windows 7

Edit :

I managed to find a work around.....in my close_application method I included lines that use psutil to kill a process. This works when I close through a UI button but not if I click the "x" in the top right of the window

Thank you


Solution

  • I think you need to link the event of clicking the "x" top right button with the killing process lines.

    This topic may be of help? PySide / PyQt detect if user trying to close window