我正在制作一个程序,以便人们可以输入他们的名字。怎么能这样做,当我按退格键时,一个条目小部件被删除?
from tkinter import*
import time
import sys
master = Tk()
master.title('Tournament Software')
master.geometry("800x800")
master.configure(background="black")
entryList = list()
def end():
master.destroy()
def click1():
master.destroy()
master1 = Tk()
master1.title("Tournament Software")
master1.geometry("800x800")
master1.configure(background="black")
la=Label(master1, text="Enter Contestant Names:",font="none 50 bold", fg="white", bg="black").pack()
lab=Label(master1, text="Press Enter For More Contestants",font="none 10 bold", fg="white",bg="black").pack()
def enter_event1(event):
entryList.append(Entry(master1,bd=5,width=50))
entryList[-1].pack()
print(entryList)
def back_event(event):
#don't know what to put here.
e=Entry(master1, bd=5,width=50).pack()
master1.bind("<Return>", enter_event1)
master1.bind("<BackSpace>", back_event)
l=Label(master, text="Tournament Software", font="none 50 bold", bg="black", fg="white").pack()
b=Button(master, text="Start",font="none 50 bold",command = click1).pack(side=LEFT)
b1=Button(master, text="Quit",font="none 55 bold",command = end).pack(side=RIGHT)
mainloop()