hey everyone, i am writting an app with tkinter, well ive tried quite alot of different ways but i couldnt find the solution for my problem. So, in that window there is time and i need it to constantly change, like every second. Any ideas? Thanks Dan08
Dan08 8 Junior Poster
Recommended Answers
Jump to PostThe answer is in your title, but you should give us your code to make things clear.
Jump to PostFor timed events you generally use the "after" function.
from Tkinter import * import datetime import time class ChangeTime(Frame): def __init__(self, master=None): master.geometry("100x50+5+5") Frame.__init__(self, master) self.pack() self.timestr = StringVar() lbl = Label(master, textvariable=self.timestr) lbl.pack() # register callback self.listenID = self.after(1000, self.newtime) def newtime(self): timenow = datetime.datetime.now() self.timestr.set("%d:%02d:%02d" …
All 7 Replies

masterofpuppets
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Dan08 8 Junior Poster

masterofpuppets
Dan08 8 Junior Poster
woooee 814 Nearly a Posting Maven
Dan08 8 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.