,所以我有這樣的代碼:擺脫線程內的標籤?
import thread
from Tkinter import *
import random
import time
Admin=Tk()
def moveit(number):
songas=Label(Admin,text=number,bg='red')
def ji():
plad=0.0
recount=0
times=0
while 1:
plad-=0.1
recount+=1
times+=1
time.sleep(0.5)
pls=0.0
pls+=plad
if recount==4:
pls=0
plad=0.0
recount=0
songas.place(relx=pls,rely=0.7)
thread.start_new_thread(ji,())
za=random.random()
button=Button(Admin,text='Press',command=lambda:moveit(str(za)))
button.place(relx=0.2)
Admin.mainloop()
,它開始向左移動,但如果你再次按下「按下」按鈕,它把對舊的基礎上增加一些更多的數字。 是否有人知道如何清除舊數字,以便只有知道的人才能清除舊數字?