我正在尝试生成一个线程,它会定期更改我的椭圆形画布的颜色,但不知何故,这段代码什么也没做:
from Tkinter import *
class Application(Frame):
def laufer(self):
self.canvas1.configure(fill='black')
def bt_start(self):
t = Thread(target=self.laufer)
t.start()
def createWidgets(self):
self.canvas1 = Canvas(self, width=50, height=50)
self.canvas1.create_oval(10, 10, 50, 50, outline="black",
fill="green", width=1)
self.canvas1.grid(row=3, column=0)
[bt_start...]
更改填充颜色的正确方法是什么?