第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Python:tkinter.TclError:無(wú)法調(diào)用“標(biāo)簽”命令:應(yīng)用程序已被破壞

Python:tkinter.TclError:無(wú)法調(diào)用“標(biāo)簽”命令:應(yīng)用程序已被破壞

炎炎設(shè)計(jì) 2023-12-12 14:59:22
當(dāng)我退出 tk 窗口時(shí),我收到這個(gè)長(zhǎng)庫(kù)錯(cuò)誤,而且我不知道如何修復(fù)它。GUI 本身和錯(cuò)誤消息位于代碼下方。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")#Lablesheader = 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)#Buttonsenter = Button(root, text="Enter", activebackground = "green", command=golf_records).place(x=440,y=80)root.mainloop()if __name__ == "__main__":  golf_records()    
查看完整描述

1 回答

?
慕萊塢森

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

基本上想象一下,您的代碼執(zhí)行到mainloop()并在那里暫停,直到您跳出循環(huán),即退出應(yīng)用程序。然后執(zhí)行后的代碼mainloop(),即為true 的語(yǔ)句,因此運(yùn)行調(diào)用激活標(biāo)簽的if函數(shù)。golf_record()GUI_print()

如何解決這個(gè)問(wèn)題?我不確定您在這里嘗試使用此代碼做什么,但如果您可以將其移至語(yǔ)句root.mainloop()末尾if,它將在代碼最初執(zhí)行時(shí)執(zhí)行該函數(shù)。如果您還有更多疑問(wèn),請(qǐng)告訴我?;蛘吒玫姆椒ㄊ菙[脫golf_records()內(nèi)部的函數(shù)調(diào)用,if因?yàn)闊o(wú)論如何都有一個(gè)調(diào)用該函數(shù)的按鈕。


查看完整回答
反對(duì) 回復(fù) 2023-12-12
  • 1 回答
  • 0 關(guān)注
  • 229 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)