我创建了一个按钮,并设置了它的回调,但是我怎样才能得到按钮的属性fg
呢?
from Tkinter import *
def callback(self):
tkMessageBox.showinfo("button", color)
top = Tk()
frame = Frame(top)
frame.pack()
greenbutton = Button(frame, text="Brown", fg="brown", command=callback)
greenbutton.pack( side = RIGHT )
bluebutton = Button(frame, text="Blue", fg="blue", command=callback)
bluebutton.pack( side = LEFT )
top.mainloop()
我只想当我单击蓝色按钮时它会告诉我它是蓝色的。