当我退出 tk 窗口时,我收到这个长库错误,而且我不知道如何修复它。GUI 本身和错误消息位于代码下方。
def golf_records()->None:
"""
This function prints the information
of golfer names and the score they have
"""
with open("golf.txt", "r") as myfile:
myfile_content = myfile.read()
GUI_print(myfile_content)
def GUI_print(data)->None:
"""
The function takes in a string found in golf.txt file
and prints it out through tkinter GUI
"""
my_label = Label(root,text = str(data),font=("ariel",15)).place(x=250,y=120)
root = Tk()
root.geometry("600x600")
#Lables
header = Label(root,text = "Current Golf Records",font=("ariel",15,"bold")).place(x=150,y=20)
header = Label(root,text = "-----------------------------",font=("ariel",15)).place(x=150,y=50)
header = Label(root,text = "Press enter to list players data: ",font=("ariel",15)).place(x=150,y=80)
#Buttons
enter = Button(root, text="Enter", activebackground = "green", command=golf_records).place(x=440,y=80)
root.mainloop()
if __name__ == "__main__":
golf_records()
慕莱坞森
相关分类