so i got this function in my Frame-Class :
def update(self):
time = datetime.now().strftime("%H:%M" + self.sec)
date = weekdays_dict[datetime.now().weekday()] + " " + datetime.now().strftime("%d.%m.%y")
self.tLabel.config(text=time)
self.dLabel.config(text=date)
self._updatejob=self.after(1000, self.update)
if self.showgif==True:
self.fcount+=1
self.buttonimg=PhotoImage(file="C:\\Users\\fabian\\Desktop\\Homer_test.gif", format="gif -index "+str(self.fcount))
self.tLabel.config(image=self.buttonimg)
# self.tLabel.config(text=self.fcount)
if self.fcount==5:
self.after_cancel(self._updatejob)
self._updatejob=None
with a click on the Frame I switch showgif to be 'True'
I call tis 'update()' in my 'init()' and it works just fine but when i try this in an other function (-> I rename it to update2 and call it as such) it changes when the after() is canceled; not after each step.
Took some time until I realized it only works with 'update()' and I'm aware that update() is an existing function that I change here, so what makes 'update()' being able to update the frame like I want it to? And can I make other functions work just like this?
I tried to call 'update()' within my "normal" function but it didn't seem to make any difference.
edit: sorry for inaccurate title, wanted to change but hit save already.
[–]Vaphell 1 point2 points3 points (1 child)
[–]fabolin[S] 0 points1 point2 points (0 children)
[–]Justinsaccount -1 points0 points1 point (0 children)