|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
from tkinter import *
root=Tk()
w=Canvas(root,width=200,height=100)
w.pack()
line1=w.create_line(0,50,200,50,fill='blue')
line2=w.create_line(100,0,100,100,fill='red',dash=(4,4))
rect1=w.create_rectangle(50,25,150,75,fill='green')
w.coords(line1,0,25,200,25)
w.itemconfig(rect1,fill='red')
w.delete(line2)
Button=(root,text="删除全部",command=(lambda x=ALL:w.delete(x))).pack()
mainloop()
运行提示text后面等号变为红色,求大神指点
为什么Button和括号中间还有个等号呢..删了就好了
- from tkinter import *
- root=Tk()
- w=Canvas(root,width=200,height=100)
- w.pack()
- line1=w.create_line(0,50,200,50,fill='blue')
- line2=w.create_line(100,0,100,100,fill='red',dash=(4,4))
- rect1=w.create_rectangle(50,25,150,75,fill='green')
- w.coords(line1,0,25,200,25)
- w.itemconfig(rect1,fill='red')
- w.delete(line2)
- Button(root, text = "删除全部",command = (lambda x=ALL:w.delete(x))).pack()
- mainloop()
复制代码
|
|