【发布时间】:2015-08-21 20:38:59
【问题描述】:
我正在使用以下函数从 Tkinter 的菜单中打开输入对话框。
def show_entry_fields(e):
global pwd
pwd = e.get()
def showPwdInputBox():
# display an input box for the password
c = Toplevel(root)
c.title("Enter your password")
c.geometry('200x160+230+130')
Label(c, text="Password").pack() #(row=0)
e1 = Entry(c, show="*")
e1.pack()
Button(c, text='OK', command= lambda: show_entry_fields(e1)).pack()
Button(c, text='Close', command=c.destroy).pack()
我需要在用户按下 OK 时关闭对话框。我怎样才能做到这一点?
【问题讨论】:
标签: python tkinter command parent-child