MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / _OnClosingCallback

Method _OnClosingCallback

PySimpleGUI/PySimpleGUI.py:11630–11658  ·  view source on GitHub ↗

Internally used method ONLY. Not sure callable. tkinter calls this when the window is closed by clicking X

(self)

Source from the content-addressed store, hash-verified

11628
11629 # IT FINALLY WORKED! 29-Oct-2018 was the first time this damned thing got called
11630 def _OnClosingCallback(self):
11631 """
11632 Internally used method ONLY. Not sure callable. tkinter calls this when the window is closed by clicking X
11633 """
11634 # global _my_windows
11635 # print('Got closing callback', self.DisableClose)
11636 if self.DisableClose:
11637 return
11638 self._auto_save_location()
11639 if self.CurrentlyRunningMainloop: # quit if this is the current mainloop, otherwise don't quit!
11640 _exit_mainloop(self, None)
11641 if self.close_destroys_window:
11642 self.TKroot.destroy() # destroy this window
11643 self.TKrootDestroyed = True
11644 self.XFound = True
11645 else:
11646 self.LastButtonClicked = WINDOW_CLOSE_ATTEMPTED_EVENT
11647 elif Window._root_running_mainloop == Window.hidden_master_root:
11648 _exit_mainloop(self, None)
11649 else:
11650 if self.close_destroys_window:
11651 self.TKroot.destroy() # destroy this window
11652 self.XFound = True
11653 else:
11654 self.LastButtonClicked = WINDOW_CLOSE_ATTEMPTED_EVENT
11655 if self.close_destroys_window:
11656 self.RootNeedsDestroying = True
11657 self._restore_stdout()
11658 self._restore_stderr()
11659
11660 def disable(self):
11661 """

Callers 1

Calls 4

_auto_save_locationMethod · 0.95
_restore_stdoutMethod · 0.95
_restore_stderrMethod · 0.95
_exit_mainloopFunction · 0.85

Tested by

no test coverage detected