I am using tkinter and several components in my project are using this pattern using after
.
class DClock():
def __init__(self, parent, parent_width):
super().__init__()
self.lbl = Label(parent,
font = ('Verdana', 40, 'bold'),
background = 'red',
foreground = 'white', text='')
string = strftime('%H:%M:%S')
self.lbl.config(text = string)
self.lbl.pack(anchor = 'center')
self.refresh()
def refresh(self):
string = strftime('%H:%M:%S')
self.lbl.config(text = string)
self.lbl.after(1000, self.refresh)
Refresh works nice for 15 minutes, but after that starts updating after 2 seconds, and later on the update period increases. In 30 minutes it is 3 seconds and so on.
What may be the problem?