0
好了,這裏是我的問題:正常打印錄入組件輸入Python3.5
下面的代碼,當由按鈕呼籲,版畫NOTHING。爲什麼? (是的,我當然在打字輸入到輸入框)
options = Tk()
options.geometry("218x156")
options.iconbitmap('original.ico')
options.title("Options")
Label(options, text = "GitHub Username:").pack()
userName = StringVar()
Entry(options, width = "30", textvariable = userName).pack()
Label(options, text = "GitHub Email:").pack()
userEmail = StringVar()
Entry(options, width = "30", textvariable = userEmail).pack()
Label(options, text = "GitHub Password:").pack()
userPassword = StringVar()
Entry(options, show = "•", width = "30", textvariable = userPassword).pack()
def optionSave():
print(userName.get())
print(userEmail.get())
print(userPassword.get())
options.destroy()
作品,
def fileOptions():
options = Tk()
options.geometry("218x156")
options.iconbitmap('original.ico')
options.title("Options")
Label(options, text = "GitHub Username:").pack()
userName = StringVar()
Entry(options, width = "30", textvariable = userName).pack()
Label(options, text = "GitHub Email:").pack()
userEmail = StringVar()
Entry(options, width = "30", textvariable = userEmail).pack()
Label(options, text = "GitHub Password:").pack()
userPassword = StringVar()
Entry(options, show = "•", width = "30", textvariable = userPassword).pack()
def optionSave():
print(userName.get())
print(userEmail.get())
print(userPassword.get())
options.destroy()
不
請注意:的唯一明顯的區別是
t他的底部沒有包住它def fileOptions():
輸出爲空白。如在其中打印zilch到控制檯。這是因爲它在一個單獨的窗口?如果是這樣,我該如何解決它?