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
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to