📄 timer
字号:
#!/bin/sh# the next line restarts using wish \exec wish "$0" "$@"# timer --# This script generates a counter with start and stop buttons.## RCS: @(#) $Id: timer,v 1.2 1998/09/14 18:23:30 stanton Exp $label .counter -text 0.00 -relief raised -width 10button .start -text Start -command { if $stopped { set stopped 0 tick }}button .stop -text Stop -command {set stopped 1}pack .counter -side bottom -fill bothpack .start -side left -fill both -expand yespack .stop -side right -fill both -expand yesset seconds 0set hundredths 0set stopped 1proc tick {} { global seconds hundredths stopped if $stopped return after 50 tick set hundredths [expr $hundredths+5] if {$hundredths >= 100} { set hundredths 0 set seconds [expr $seconds+1] } .counter config -text [format "%d.%02d" $seconds $hundredths]}bind . <Control-c> {destroy .}bind . <Control-q> {destroy .}focus .
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -