我遇到了 Python 的 Tkinter 模块的问题。当我尝试制作画布时,它在外壳打印完成之前不会出现。我的代码如下所示:
from tkinter import *
import time
tk = Tk()
canvas = Canvas(tk, width=500, height=500)
canvas.pack()
money = 500
canvas.create_text(100, 30, text="Money: " + str(money), font=('Impact', 25))
time.sleep(2)
print("Give Me A Chance To Load")
time.sleep(4)
buy = input("Will You Buy A Cow?")
if buy == "Yes":
money -= 50
if buy == "No":
money -= 999999999999999999999
这个程序应该更新画布上的钱。问题是直到你回答输入并且钱仍然在500之前画布不会出现。我做错了什么?