【发布时间】:2017-06-29 18:31:04
【问题描述】:
当我单击 tk 画布上的矩形时,我一直在尝试使函数运行。
代码如下:
from tkinter import *
window = Tk()
c = Canvas(window, width=300, height=300)
def clear():
canvas.delete(ALL)
playbutton = c.create_rectangle(75, 25, 225, 75, fill="red")
playtext = c.create_text(150, 50, text="Play", font=("Papyrus", 26), fill='blue')
c.pack()
window.mainloop()
有人知道我应该怎么做吗?
【问题讨论】:
-
你试过用画布
bind方法吗? -
看看
.tag_bind方法here
标签: python tkinter tkinter-canvas