2

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?

mickNeill
  • 346
  • 5
  • 22

1 Answers1

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