[Tkinter-discuss] Re: tkinter pmw notebook

dimitri pater dimitri.pater at gmail.com
Thu Apr 21 14:38:29 CEST 2005


Hello,

here is a little test app for the "lowercommand" of the notebook:

# test app auto refresh pages of a notebook
import Tkinter
import Pmw
import time

class Notebook:
def __init__(self, parent):
# Create and pack the NoteBook.
notebook = Pmw.NoteBook(parent, lowercommand=self.timePlease)
notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10)

# Add the "Hello" page to the notebook.
page = notebook.add('Appearance')
notebook.tab('Appearance').focus_set()

# Add the "Now" page to the notebook.
page = notebook.add('Now')
self.timeframe = Tkinter.Frame(page)
self.timeframe.pack(side="bottom", fill="x", anchor="nw", pady=5, padx=5)
notebook.setnaturalsize()

def timePlease(self, Now):
while True:
try:
self.nowtime.destroy()
break
except AttributeError:
break

t = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
self.nowtime = Tkinter.Label(self.timeframe, text=t, pady=15, padx=15)
self.nowtime.pack()

if __name__ == '__main__':
root = Tkinter.Tk()
geometry = '400x400+0+0'
root.geometry(geometry)
root.title('Demo notebook refresh')
root.deiconify()
Pmw.initialise(root)
GUI = Notebook(root)
root.mainloop() 




-- 
Please visit dimitri's website: www.serpia.com <http://www.serpia.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20050421/0dcc44e5/attachment.htm


More information about the Tkinter-discuss mailing list