我目前正在尝试在python中制作游戏,但遇到了问题。游戏的想法是在你的生活中取得进步并尽可能多地赚钱。我遇到的问题是,当我点击按钮赚钱时,整个很多只是崩溃这里是python发出的错误。
现在这是我的代码。
import tkinter
Money = 0
Years = 0
def ProgressYears():
global Years
Years += 1
AgeNumber.configure(text=Years)
def Money():
global Money
Money += 20
MoneyNumber.configure(text=Money)
window = tkinter.Tk()
window.title("100 Days")
window.geometry('400x400')
window.wm_iconbitmap("100DAYS.ico")
window.configure(background="Light Blue")
#AGE
AgeDisplay = tkinter.Label(text="Age:", bg="Light Blue")
AgeDisplay.pack()
AgeNumber = tkinter.Label(window, text=Years, bg="Light Blue")
AgeNumber.pack()
#MONEY
MoneyDisplay = tkinter.Label(text="Money:", bg="Light Blue")
MoneyDisplay.pack()
MoneyNumber = tkinter.Label(window, text=Money, bg="Light Blue")
MoneyNumber.pack()
#PROGRESS
Progress = tkinter.Button(text="Progress", command=ProgressYears)
Progress.pack()
#WORK
Work = tkinter.Button(text="Earn Money", command=Money)
Work.pack()
如果有人可以排除故障,那就太棒了