summaryrefslogtreecommitdiffstats
path: root/Tools/idle/MultiStatusBar.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-02-15 18:04:52 (GMT)
committerGuido van Rossum <guido@python.org>2000-02-15 18:04:52 (GMT)
commit17752f7c4bf2b34328e097d7eb541369c48815c5 (patch)
tree1de7322bab7d87d918f5a422e039dbda0705096c /Tools/idle/MultiStatusBar.py
parent2bb8e72046b9efa5c7931b2d67ef5fbcf7a53c0a (diff)
downloadcpython-17752f7c4bf2b34328e097d7eb541369c48815c5.zip
cpython-17752f7c4bf2b34328e097d7eb541369c48815c5.tar.gz
cpython-17752f7c4bf2b34328e097d7eb541369c48815c5.tar.bz2
Status bar code -- by Moshe Zadka.
Diffstat (limited to 'Tools/idle/MultiStatusBar.py')
-rw-r--r--Tools/idle/MultiStatusBar.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tools/idle/MultiStatusBar.py b/Tools/idle/MultiStatusBar.py
new file mode 100644
index 0000000..c11db3e
--- /dev/null
+++ b/Tools/idle/MultiStatusBar.py
@@ -0,0 +1,32 @@
+from Tkinter import *
+
+class MultiStatusBar(Frame):
+
+ def __init__(self, master=None, **kw):
+ if master is None:
+ master = Tk()
+ apply(Frame.__init__, (self, master), kw)
+ self.labels = {}
+
+ def set_label(self, name, text='', side=LEFT):
+ if not self.labels.has_key(name):
+ label = Label(self, bd=1, relief=SUNKEN, anchor=W)
+ label.pack(side=side)
+ self.labels[name] = label
+ else:
+ label = self.labels[name]
+ label.config(text=text)
+
+def _test():
+ b = Frame()
+ c = Text(b)
+ c.pack(side=TOP)
+ a = MultiStatusBar(b)
+ a.set_label("one", "hello")
+ a.set_label("two", "world")
+ a.pack(side=BOTTOM, fill=X)
+ b.pack()
+ b.mainloop()
+
+if __name__ == '__main__':
+ _test()