0

I have read in many sources that it is better to avoid using update method at all. But I have a situation, that it is the only thing that is working (even update idletask does not help) and looks like the code will not produce memory leak. Here is a simple example:

import tkinter as tk
root = tk.Tk()


def do_something():

    # ===  there I have some code  ===
    
    root.update()
    root.after_idle(do_something)


do_something()
root.mainloop()

As far as I can judge, it is not possible here to be loops and memory leaks. Because I am using after_idle, it will run function again when there are no events left in mainloop to process, that is, in my opinion, will happen after root.update have finished. Am I right or there could be special cases when this code will fail?

Danya K
  • 165
  • 1
  • 10
  • What would you actually do in that method? – AKX Aug 10 '23 at 12:17
  • @AKX it is hard to explain. It helps to remove a problem that I wrote about [there](https://stackoverflow.com/questions/76741844/glitches-happen-when-using-place-method-too-often). I tried different ways, only using update works fast and as I want – Danya K Aug 10 '23 at 12:23
  • Do you want to update `Label`? – toyota Supra Aug 10 '23 at 19:14

0 Answers0