I have a pyinstaller executable wxpython GUI that works fine. The only issue I am having is that when I close the program with the X button on the window, it stays running in the background. Does anyone know of a way to kill the process when the window X button is clicked?
Asked
Active
Viewed 2,169 times
2
-
Are you using `self.Destroy()` when exiting? – Rolf of Saxony Aug 04 '17 at 14:07
-
I am when using the wx.Button. This is happening when the user simply closes the window. I am not sure how to link self.destroy with the window's close button – mickNeill Aug 04 '17 at 14:15
1 Answers
1
You can bind the Close
window event, which is wx.EVT_CLOSE
like every other event i.e.:
self.Bind(wx.EVT_CLOSE, self.OnExit)
Then in you OnExit(self,event)
use self.Destroy()
If that still doesn't work, you almost certainly have something still open. If you are unable to track that down, a workaround is using sys.exit()
but that really should be frowned upon.

Rolf of Saxony
- 21,661
- 5
- 39
- 60
-
That did it, I had self.Close() instead of Destory() -- Thanks for the help – mickNeill Aug 04 '17 at 14:38