Python:通过Tkinter添加按钮
问题描述:
我正在尝试向两个已有的按钮添加第三个按钮。但总是得到一个错误信息,不知道什么是错的。Python:通过Tkinter添加按钮
Import Tkinter as tki
btn = tki.Button(self.root, text="yes!", command=self.yes, fg="black", bg="white", font=("Courier", 22))
btn.grid(row=4, column=1, padx=10, pady=10, sticky="NSEW")
btn2 = tki.Button(self.root, text="No!", command=self.no, fg="black", bg="white", font=("Courier", 22))
btn2.grid(row=4, column=0, padx=10, pady=10, sticky="NSEW")
btn3 = tki.Button(self.root, text="HELP", command=self.help, fg="black", bg="white", font=("Courier",22))
btn3.grid(row=5, column=0, padx=10, pady=10, sticky="NSEW")
self.w = tki.Canvas(self.root,width=48,height=48, bg="white")
self.w.grid(row=3,column=0,columnspan=3)
self.circle = self.w.create_oval(2,2,48,48,fill="white")
不,是的,是的,帮助在代码中实现。对于否,是的一切正常。但现在我总是得到一个IndentationError:意外的缩进。 你能帮我吗?
您分享的代码不完整。 '自我。 w'和'自我。圆应该在一个类 –
什么是缩进错误? – Judith
我知道代码不完整,只是为了告诉你问题是什么。 – Judith