- 对不起,我的英语不好
- 我想要一个 Cps 测试,每次点击一个按钮,计数器就会上升 1。我编写了一些代码,但没有用,请帮助我:
import tkinter as tk
from time import time
Cpp = 0
clicks = []
def clicked(Cpp):
Cpp+=1
cps = ("Cps: "+ str(Cpp))
frame_label = tk.Frame()
text = tk.Label(master=frame_label, text=cps)
text.pack()
frame_label.place(x=0, y=29)
root = tk.Tk()
button = tk.Frame
button = tk.Button(root, text='Click', command=clicked(Cpp)).pack(padx=5, pady=12)
tk.mainloop()
它应该看起来像这样: