我试图从文本框中创建一个变量,但是当我显示条目时,它只显示“youentered{}”
我已经导入了所有需要导入的内容,并且在OS10.9上运行了Python2.7
def beenclicked():
tkMessageBox.showinfo("You entered"+petals.get())
gui=Tk()
gui.title("Flower Creator")
label1= Label(gui, text="Number of petals:")
label1.pack(side='top',pady=10)
petals = Entry(gui)
petals.pack(side='top')
button1 = Button(gui, text="Generate flower", width=20, command=beenclicked)
button1.pack(side='bottom',pady=15,padx=15)
gui.mainloop()
^{} 的第一个参数是标题。试着这样做:
您可能没有看到用户的输入,因为它在对话框窗口的标题中,并且窗口不会自动缩放以适应标题。对话框内容为空,因为您只提供了标题。你知道吗
相关问题 更多 >
编程相关推荐