diff options
author | Guido van Rossum <guido@python.org> | 1998-10-10 18:48:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-10 18:48:31 (GMT) |
commit | 3b4ca0ddad8d1e224f71e89f4c7fbc8de5c6edc4 (patch) | |
tree | 1a66ed7c7eec87f31d61a2a083096e5cad89a39c /Tools/idle/FrameViewer.py | |
parent | dc1adabcb86ee0813c9bae2d5cc59be5cad1ff31 (diff) | |
download | cpython-3b4ca0ddad8d1e224f71e89f4c7fbc8de5c6edc4.zip cpython-3b4ca0ddad8d1e224f71e89f4c7fbc8de5c6edc4.tar.gz cpython-3b4ca0ddad8d1e224f71e89f4c7fbc8de5c6edc4.tar.bz2 |
Initial checking of Tk-based Python IDE.
Features: text editor with syntax coloring and undo;
subclassed into interactive Python shell which adds history.
Diffstat (limited to 'Tools/idle/FrameViewer.py')
-rw-r--r-- | Tools/idle/FrameViewer.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Tools/idle/FrameViewer.py b/Tools/idle/FrameViewer.py new file mode 100644 index 0000000..e5a6051 --- /dev/null +++ b/Tools/idle/FrameViewer.py @@ -0,0 +1,38 @@ +from repr import Repr +from Tkinter import * + +class FrameViewer: + + def __init__(self, root, frame): + self.root = root + self.frame = frame + self.top = Toplevel(self.root) + self.repr = Repr() + self.repr.maxstring = 60 + self.load_variables() + + def load_variables(self): + row = 0 + if self.frame.f_locals is not self.frame.f_globals: + l = Label(self.top, text="Local Variables", + borderwidth=2, relief="raised") + l.grid(row=row, column=0, columnspan=2, sticky="ew") + row = self.load_names(self.frame.f_locals, row+1) + l = Label(self.top, text="Global Variables", + borderwidth=2, relief="raised") + l.grid(row=row, column=0, columnspan=2, sticky="ew") + row = self.load_names(self.frame.f_globals, row+1) + + def load_names(self, dict, row): + names = dict.keys() + names.sort() + for name in names: + value = dict[name] + svalue = self.repr.repr(value) + l = Label(self.top, text=name) + l.grid(row=row, column=0, sticky="w") + l = Entry(self.top, width=60, borderwidth=0) + l.insert(0, svalue) + l.grid(row=row, column=1, sticky="w") + row = row+1 + return row |