On Thu, 25 Feb 2021 00:27:33 +0000 MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 2021-02-24 23:23, John O'Hagan wrote: [...] > > In case it's relevant, to clarify what I mean by "freeze": the > > window continues to display the digits indefinitely if no attempt > > is made to interact with the window, but after some hours have > > passed, if I click on the window the digits stop displaying, > > resizing causes fragmented images of the desktop to appear in the > > window, and it cannot be closed except by terminating the process > > (e.g, in a task manager). > Hmm. A memory leak perhaps? It's more noticeable if you reduce the > timeout from 100 to 1. > A workaround is to update the label's text instead: > > from tkinter import * > from random import randint > > root = Tk() > > def update(): > label.config(text=randint(0, 9)) > root.after(1, update) > > label = Label() > label.pack() > update() > mainloop() > > It's neater anyway. That does avoid the problem in the toy example AFAICT, but as I mentioned in my OP, in the real application there are multiple streams of data which come and go, and each stream is displayed and controlled by a frame containing multiple widgets. The number of streams and therefore frames varies over time, so it seems necessary to create and destroy them. I could think about redesigning that whole approach, but it seems logical to me and it really should work! Terry Reedy also suggested a memory leak, but where? Surely not in the example code? Dare I say, maybe a bug in tkinter? Thanks for your suggestions. -- john -- https://mail.python.org/mailman/listinfo/python-list