Closes window. Users can safely call even if window has been destroyed. Should always call when done with a window so that resources are properly freed up within your thread.
(self)
| 11550 | return |
| 11551 | |
| 11552 | def close(self): |
| 11553 | """ |
| 11554 | Closes window. Users can safely call even if window has been destroyed. Should always call when done with |
| 11555 | a window so that resources are properly freed up within your thread. |
| 11556 | """ |
| 11557 | self._auto_save_location() |
| 11558 | |
| 11559 | try: |
| 11560 | del Window._active_windows[self] # will only be in the list if window was explicitly finalized |
| 11561 | except: |
| 11562 | pass |
| 11563 | |
| 11564 | try: |
| 11565 | self.TKroot.update() # On Linux must call update if the user closed with X or else won't actually close the window |
| 11566 | except: |
| 11567 | pass |
| 11568 | |
| 11569 | self._restore_stdout() |
| 11570 | self._restore_stderr() |
| 11571 | |
| 11572 | _TimerPeriodic.stop_all_timers_for_window(self) |
| 11573 | |
| 11574 | if self.TKrootDestroyed: |
| 11575 | return |
| 11576 | try: |
| 11577 | self.TKroot.destroy() |
| 11578 | self.TKroot.update() |
| 11579 | Window._DecrementOpenCount() |
| 11580 | except: |
| 11581 | pass |
| 11582 | # if down to 1 window, try and destroy the hidden window, if there is one |
| 11583 | # if Window.NumOpenWindows == 1: |
| 11584 | # try: |
| 11585 | # Window.hidden_master_root.destroy() |
| 11586 | # Window.NumOpenWindows = 0 # if no hidden window, then this won't execute |
| 11587 | # except: |
| 11588 | # pass |
| 11589 | self.TKrootDestroyed = True |
| 11590 | |
| 11591 | # Free up anything that was held in the layout and the root variables |
| 11592 | self.Rows = None |
| 11593 | self.TKroot = None |
| 11594 | |
| 11595 | def is_closed(self, quick_check=None): |
| 11596 | """ |