在我的代码中,每次在输入小部件上输入时按 Enter 键,条目上的文本都会打印在其下方的标签上,但文本始终位于标签的中间。有没有办法让它打印在顶部?
from tkinter import *
root = Tk()
root.state('zoomed')
def AddList(event):
de = dataInput.get()
d = dataList['text'] + de + "\n"
dataList.config(text=d)
dataInput.delete('0', 'end')
dataLabel = Label(root, width=4, text="Dados").grid(column=0, row=0)
dataInput = Entry(root,width=4)
dataInput.bind('<Return>', AddList)
dataInput.grid(column=0, row=1)
dataList = Label(root, text="", width=4, height=43, bg='#8c8c8c')
dataList.grid(column=0, row=2, sticky=NS)
root.mainloop()