这是我的代码:
import Tkinter
from Tkconstants import *
tk = Tkinter.Tk()
class MyApp:
def __init__(self,parent):
self.frame = Tkinter.Frame(tk,relief=RIDGE,borderwidth=2)
self.frame.pack()
self.message = Tkinter.Message(tk,text="Symbol Disolay")
label=Tkinter.Label(self.frame,text="Is Symbol Displayed")
label.pack()
self.button1=Tkinter.Button(self.frame,text="YES")
self.button1.pack(side=BOTTOM)
self.button1.bind("<Button-1>", self.button1Click)
self.button2=Tkinter.Button(self.frame,text="NO")
self.button2.pack()
self.button2.bind("<Button-1>", self.button2Click)
def button1Click(self, event):
"pressed yes"
def button2Click(self, event):
"pressed no"
myapp = MyApp(tk)
tk.mainloop()
我应该在 button1Click() 和 button2Click() 中做什么,以便它们以字符串格式向我的程序返回“YES”或“NO”?