import tkinter as tk
import time
window=tk.Tk()
window.title('测手速游戏')
window.geometry('600x500')
# Label 标签
# 速度
# 时间
start=time.time()
ci=0
def chuo():
global ci
global start
end=time.time()
ci=ci+1
la["text"] = '点赞次数:%d 次\n游戏时间:%.2f 秒\n' \
'速度:%.2f 次/秒'%(ci,end-start,ci/(end-start))
la=tk.Label(
window,
bg='skyblue',
fg='black',
font=(None,20),
text='手速次数',
)
# la.pack()
# place地方
la.place(x=0, y=0,width=600,height=100)
# 按钮 Button
bu=tk.Button(
window,
bg='red',
fg='black',
font=(None,24),
text='戳他',
command= chuo
)
bu.place(x=0,y=101,width=600,height=50)
def you():
pass
bu2=tk.Button(
window,
bg='red',
fg='black',
font=(None,24),
text='游戏',
command= you
)
bu2.place(x=0,y=201,width=600,height=50)
window.mainloop()
succi -测手速游戏
最新推荐文章于 2020-06-27 14:51:20 发布