Fix for timeout timer not gettin cancelled. NEW Demo - LCD clock for Raspberry Pi
This commit is contained in:
parent
a5c7b22705
commit
c2fb118e5e
File diff suppressed because one or more lines are too long
|
@ -1389,10 +1389,10 @@ class Image(Element):
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
image = tk.PhotoImage(file=filename)
|
image = tk.PhotoImage(file=filename)
|
||||||
elif data is not None:
|
elif data is not None:
|
||||||
if type(data) is bytes:
|
# if type(data) is bytes:
|
||||||
image = tk.PhotoImage(data=data)
|
image = tk.PhotoImage(data=data)
|
||||||
else:
|
# else:
|
||||||
image = data
|
# image = data
|
||||||
else: return
|
else: return
|
||||||
width, height = image.width(), image.height()
|
width, height = image.width(), image.height()
|
||||||
self.tktext_label.configure(image=image, width=width, height=height)
|
self.tktext_label.configure(image=image, width=width, height=height)
|
||||||
|
@ -2654,6 +2654,10 @@ class Window:
|
||||||
self.TimerCancelled = False
|
self.TimerCancelled = False
|
||||||
self.TKAfterID = self.TKroot.after(timeout, self._TimeoutAlarmCallback)
|
self.TKAfterID = self.TKroot.after(timeout, self._TimeoutAlarmCallback)
|
||||||
self.TKroot.mainloop()
|
self.TKroot.mainloop()
|
||||||
|
try:
|
||||||
|
self.TKroot.after_cancel(self.TKAfterID)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.TimerCancelled = True
|
self.TimerCancelled = True
|
||||||
if self.RootNeedsDestroying:
|
if self.RootNeedsDestroying:
|
||||||
self.TKroot.destroy()
|
self.TKroot.destroy()
|
||||||
|
|
Loading…
Reference in New Issue