0
我收到錯誤並無法從選項按鈕,複選框和文本區域檢索值。Tkinter - TypeError:retrieve_input()只需要1個參數(0給出)
類型錯誤:retrieve_input()採用完全1個參數(0給出) NameError:名稱 'checkCmd' 當使用函數作爲值的命令沒有被定義
#!C:/Python27/python.exe
from Tkinter import *
import ImageTk, Image
def retrieve_input(event):
getter = text.get(text)
getterV = v.get(v)
getterChk = chkvar.get(chkvar)
root.destroy()
root = Tk()
root.title('HADOUKEN!')
text = Text(root, height=16, width=40)
scroll = Scrollbar(root, command=text.yview)
text.configure(yscrollcommand=scroll.set)
text.grid(sticky=E)
scroll.grid(row=0,column=1,sticky='ns')
text.focus()
text.bind(retrieve_input)
v = ""
chkvar = IntVar()
chkvar.set(0)
c = Checkbutton(root, text="CaseIt", variable=chkvar)
c.grid(row=1,column=0,sticky=W)
radio1 = Radiobutton(root, text="Src", variable=v, value=1)
radio1.grid(row=1,column=0)
radio1.focus()
radio2 = Radiobutton(root, text="Dst", variable=v, value=2)
radio2.grid(row=2,column=0)
b1 = Button(root, text="Submit", command=retrieve_input)
b1.grid(row=1, column=2)
img = ImageTk.PhotoImage(Image.open("Hadoken.gif"))
panel = Label(root, image = img)
panel.grid(row=0, column=2)
root.mainloop()
if checkCmd.get() == 0:
print "yes"
else:
print "no"