我的代码又出错了!伙计,我只是一直在弄…我以前的那个(修好了)
是herefrom Tkinter import *
def get_info(key):
pass#do more later
def create_new():
create = Toplevel(root)
create.title('Create A New Contact')
Label(create, text='Name: ').grid(row=0, sticky=W+E)
name = Entry(create, width=8).grid(row=1, sticky=W+E)
Label(create, text='Address(ex. 1111 Main St, MyCity, Anystate 12345): ', wrapLength=1).grid(row=2, sticky=W+E)
address = Entry(create, width=8).grid(row=3, sticky=W+E)
def access():
access_window = Toplevel(root)
access_window.title("Access a Contact")
Label(access_window, text="Enter a first name: ").grid(row=0, sticky=W+E)
access_key = Entry(access_window, width=8).grid(row=1, sticky=W+E)
Button(access_window, text="Submit", command=lambda: get_info(access_key.get('0.0', 'end-1c'))).grid(row=2, sticky='W+E')
root = Tk()
root.title('Address Book')
button1 = Button(root, text="Create New", command=create_new).grid(row=0, column=0)
button2 = Button(root, text=“Access Person”, command=access).grid(row=0, column=1)
这应该没什么错,但确实有。这不是一个错误,只是当我点击“创建新”按钮时,只有名称条目显示出来,其他的都不会显示。使用“访问人”按钮,它只显示“输入名称:”而没有输入。在