For a game I'm making, I need the user to input data, and I want to call a method that adds a little Entry box to my GUI (to get the user's name), but when I try to do so the Entry widget basically masks all other things and makes them disappear. Any ideas on why this happens or how to fix? Here's an example of the problematic code:
root = tkinter.Tk()
root.title('2048')
width = 500
height = 800
root.geometry('%sx%s' % (width, height))
canvas = tkinter.Canvas(root, width=width, height=height, highlightthickness=0)
canvas.pack()
r = canvas.create_rectangle(0, 0, 50, 50)
canvas.move(r, 50, 50)
def keyed(event):
e = tkinter.Entry(canvas)
e.pack()
canvas.bind('<Key>', keyed)
canvas.focus_set()
root.mainloop()