热线电话:13121318867

登录
2019-02-25 阅读量: 610
python如何创建秒表(2)

以下代码紧接上一篇文章《python如何创建秒表(1)》

# If rest is pressed after pressing stop.

if running==False:      

reset['state']='disabled'

label['text']='Welcome!'

# If reset is pressed while the stopwatch is running.

else:               

label['text']='Starting...'

root = Tkinter.Tk()

root.title("Stopwatch")

# Fixing the window size.

root.minsize(width=250, height=70)

label = Tkinter.Label(root, text="Welcome!", fg="black", font="Verdana 30 bold")

label.pack()

start = Tkinter.Button(root, text='Start', 

width=15, command=lambda:Start(label))

stop = Tkinter.Button(root, text='Stop', 

width=15, state='disabled', command=Stop)

reset = Tkinter.Button(root, text='Reset',

width=15, state='disabled', command=lambda:Reset(label))

start.pack()

stop.pack()

reset.pack()

root.mainloop()

0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子