mirror of
https://github.com/python/cpython.git
synced 2025-09-11 11:17:16 +00:00
Add a close() method and bind to WM_DELETE_WINDOW protocol
This commit is contained in:
parent
1956352b08
commit
ae08d3897a
1 changed files with 4 additions and 0 deletions
|
@ -18,6 +18,7 @@ class StackViewer:
|
||||||
root = top = Tk()
|
root = top = Tk()
|
||||||
else:
|
else:
|
||||||
top = Toplevel(root)
|
top = Toplevel(root)
|
||||||
|
self.top.protocol("WM_DELETE_WINDOW", self.close)
|
||||||
self.root = root
|
self.root = root
|
||||||
self.top = top
|
self.top = top
|
||||||
top.wm_title("Stack viewer")
|
top.wm_title("Stack viewer")
|
||||||
|
@ -52,6 +53,9 @@ class StackViewer:
|
||||||
self.load_stack(stack)
|
self.load_stack(stack)
|
||||||
self.statuslabel.config(text=getexception())
|
self.statuslabel.config(text=getexception())
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.top.destroy()
|
||||||
|
|
||||||
def load_stack(self, stack):
|
def load_stack(self, stack):
|
||||||
self.stack = stack
|
self.stack = stack
|
||||||
l = self.listbox
|
l = self.listbox
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue