PyXR

c:\python24\lib \ idlelib \ MultiStatusBar.py



0001 from Tkinter import *
0002 
0003 class MultiStatusBar(Frame):
0004 
0005     def __init__(self, master=None, **kw):
0006         if master is None:
0007             master = Tk()
0008         Frame.__init__(self, master, **kw)
0009         self.labels = {}
0010 
0011     def set_label(self, name, text='', side=LEFT):
0012         if not self.labels.has_key(name):
0013             label = Label(self, bd=1, relief=SUNKEN, anchor=W)
0014             label.pack(side=side)
0015             self.labels[name] = label
0016         else:
0017             label = self.labels[name]
0018         label.config(text=text)
0019 
0020 def _test():
0021     b = Frame()
0022     c = Text(b)
0023     c.pack(side=TOP)
0024     a = MultiStatusBar(b)
0025     a.set_label("one", "hello")
0026     a.set_label("two", "world")
0027     a.pack(side=BOTTOM, fill=X)
0028     b.pack()
0029     b.mainloop()
0030 
0031 if __name__ == '__main__':
0032     _test()
0033 

Generated by PyXR 0.9.4
SourceForge.net Logo