diff options
author | Guido van Rossum <guido@python.org> | 1998-10-10 19:15:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-10 19:15:32 (GMT) |
commit | 8571ed86479c03a67a6bae44e8115379c792b41c (patch) | |
tree | 580afd0b36f3dde7e3fc3f91295145d63f5d9393 | |
parent | 3d0669d8a15961245e8e118583863e2b18123f1d (diff) | |
download | cpython-8571ed86479c03a67a6bae44e8115379c792b41c.zip cpython-8571ed86479c03a67a6bae44e8115379c792b41c.tar.gz cpython-8571ed86479c03a67a6bae44e8115379c792b41c.tar.bz2 |
Add a label at the top showing (very basic) help for the stack viewer.
Add a label at the bottom showing the exception info.
-rw-r--r-- | Tools/idle/StackViewer.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Tools/idle/StackViewer.py b/Tools/idle/StackViewer.py index a59668a..dbfc4b0 100644 --- a/Tools/idle/StackViewer.py +++ b/Tools/idle/StackViewer.py @@ -21,6 +21,11 @@ class StackViewer: self.root = root self.top = top top.wm_title("Stack viewer") + # Create help label + self.helplabel = Label(top, + text="Click once to view variables; twice for source", + borderwidth=2, relief="groove") + self.helplabel.pack(fill="x") # Create top frame, with scrollbar and listbox self.topframe = Frame(top) self.topframe.pack(fill="both", expand=1) @@ -38,10 +43,14 @@ class StackViewer: self.listbox.bind("<ButtonPress-3>", self.popup_event) self.listbox.bind("<Key-Up>", self.up_event) self.listbox.bind("<Key-Down>", self.down_event) + # Create status label + self.statuslabel = Label(top, text="status") + self.statuslabel.pack(fill="x") # Load the stack linecache.checkcache() stack = getstack() self.load_stack(stack) + self.statuslabel.config(text=getexception()) def load_stack(self, stack): self.stack = stack @@ -232,6 +241,18 @@ def getstack(t=None, f=None): return stack +def getexception(type=None, value=None): + if type is None: + type = sys.last_type + value = sys.last_value + if hasattr(type, "__name__"): + type = type.__name__ + s = str(type) + if value is not None: + s = s + ": " + str(value) + return s + + class NamespaceViewer: def __init__(self, frame, title, dict): |