python - Looking for a way to stop memory leak in this basic program -


i'm new python. program creates label inside tk() window. word "hi" written label indefinitely. how can delete old hi's while still writing new ones indefinitely? how stop memory leak? here code:

from tkinter import *  def box(a):     z=label(root,text='%s'%(a))     z.place(width=50,height=20)  def start(root):     a="hi"     box(a)     root.after(100, start, root)  root = tk() start(root) root.mainloop() 

how replace text instead of creating label object every time.

from tkinter import *  def box(a):     z['text'] =  def start(root):     box('hi')     root.after(100, start, root)  root = tk() z = label(root, text='') z.place(width=50, height=20) start(root) root.mainloop() 

from tkinter import *   def start(root, z):     = 'hi'     z['text'] =     root.after(100, start, root, z)   root = tk() z = label(root, text='') z.place(width=50, height=20)  start(root, z)  root.mainloop() 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -