def __init__(self, parent, *args, **kw): apply(Frame.__init__, (self, parent) + args, kw) button = Button(self, text='close', command=parent.close) button.pack(side=Tkinter.LEFT) button = Button(self, text='iconify', command=parent.iconify) button.pack(side=Tkinter.LEFT)
if (__name__ == '__main__'): from memops.gui.Button import Button from memops.gui.Util import createQuitButton def getText(): print 'getText:', text.getText() root = Tkinter.Tk() frame = Frame(root) frame.pack(side=Tkinter.TOP) button = Button(frame, text='get text', command=getText) button.pack(side=Tkinter.LEFT) button = createQuitButton(frame) button.pack(side=Tkinter.LEFT) text = ScrolledText( root, width=60, height=10, #text='in the beginning') text='in the beginning', xscroll=False) text.pack(side=Tkinter.TOP, expand=Tkinter.YES, fill=Tkinter.BOTH) root.mainloop()
self.progress = float(value) else: raise 'Cannot set to a value exceeding the total' self.update() def setText(self, text=''): self.text = text self.label.set(self.text) if (__name__ == '__main__'): from memops.gui.Button import Button root = Tkinter.Tk() pb = None def makePB(): pb.set(0) pb.open() for i in range(100): time.sleep(0.01) pb.increment() b = Button(root, text="Hit Me", command=makePB) b.pack() pb = ProgressBar(root, text='Increments') root.mainloop()
popup.open() def iconify(): if (popup): popup.iconify() def deiconify(): if (popup): popup.deiconify() root.protocol('WM_DELETE_WINDOW', quit) button = Button(root, text='new popup', command=new) button.pack(side=Tkinter.TOP) button = Button(root, text='new2 popup', command=new2) button.pack(side=Tkinter.TOP) button = Button(root, text='lift popup', command=lift) button.pack(side=Tkinter.TOP) button = Button(root, text='open popup', command=open) button.pack(side=Tkinter.TOP) button = Button(root, text='close popup', command=close) button.pack(side=Tkinter.TOP) button = Button(root, text='iconify popup', command=iconify) button.pack(side=Tkinter.TOP)