Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../idlelib
File: MultiStatusBar.py
from Tkinter import *
[0] Fix | Delete
[1] Fix | Delete
class MultiStatusBar(Frame):
[2] Fix | Delete
[3] Fix | Delete
def __init__(self, master=None, **kw):
[4] Fix | Delete
if master is None:
[5] Fix | Delete
master = Tk()
[6] Fix | Delete
Frame.__init__(self, master, **kw)
[7] Fix | Delete
self.labels = {}
[8] Fix | Delete
[9] Fix | Delete
def set_label(self, name, text='', side=LEFT, width=0):
[10] Fix | Delete
if name not in self.labels:
[11] Fix | Delete
label = Label(self, borderwidth=0, anchor=W)
[12] Fix | Delete
label.pack(side=side, pady=0, padx=4)
[13] Fix | Delete
self.labels[name] = label
[14] Fix | Delete
else:
[15] Fix | Delete
label = self.labels[name]
[16] Fix | Delete
if width != 0:
[17] Fix | Delete
label.config(width=width)
[18] Fix | Delete
label.config(text=text)
[19] Fix | Delete
[20] Fix | Delete
def _multistatus_bar(parent):
[21] Fix | Delete
root = Tk()
[22] Fix | Delete
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
[23] Fix | Delete
root.geometry("+%d+%d" %(x, y + 150))
[24] Fix | Delete
root.title("Test multistatus bar")
[25] Fix | Delete
frame = Frame(root)
[26] Fix | Delete
text = Text(frame)
[27] Fix | Delete
text.pack()
[28] Fix | Delete
msb = MultiStatusBar(frame)
[29] Fix | Delete
msb.set_label("one", "hello")
[30] Fix | Delete
msb.set_label("two", "world")
[31] Fix | Delete
msb.pack(side=BOTTOM, fill=X)
[32] Fix | Delete
[33] Fix | Delete
def change():
[34] Fix | Delete
msb.set_label("one", "foo")
[35] Fix | Delete
msb.set_label("two", "bar")
[36] Fix | Delete
[37] Fix | Delete
button = Button(root, text="Update status", command=change)
[38] Fix | Delete
button.pack(side=BOTTOM)
[39] Fix | Delete
frame.pack()
[40] Fix | Delete
frame.mainloop()
[41] Fix | Delete
root.mainloop()
[42] Fix | Delete
[43] Fix | Delete
if __name__ == '__main__':
[44] Fix | Delete
from idlelib.idle_test.htest import run
[45] Fix | Delete
run(_multistatus_bar)
[46] Fix | Delete
[47] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function