我一直在控制台中获取它,这是什么意思!?
文件“ C:/Users/deus2/PycharmProjects/Testing/ClickerGame.py”,第17行在pointsPlus中点+ = 1 * mult
TypeError:+ =:'Event'和'int'的不受支持的操作数类型
from tkinter import *
main = Tk()
frame = Frame(main, width = 500, height = 575)
global points
global mult
points = int(0)
mult = int(1)
pointsLabel = Label(main, text = points)
pointsLabel.pack()
def pointsPlus(points):
points += 1*mult
pointsLabel()
pointsLabel.update()
frame.bind('<Button-1>', pointsPlus)
frame.pack()
main.mainloop()
此代码应该有效
from tkinter import *
main = Tk()
frame = Frame(main, width = 500, height = 575)
points = 0
mult = 1
pointsLabel = Label(main, text = points)
pointsLabel.pack()
def pointsPlus():
global points # assuming you want to modify global parameter here
points += 1*mult
pointsLabel()
pointsLabel.update()
frame.bind('<Button-1>', pointsPlus)
frame.pack()
main.mainloop()