after


Tcl/Tk


#!/usr/local/bin/wish4.2

set number 0

proc inc {} {
	global number

	if {$number < 10} {
		incr number
	} else {
		set number 1
	}
	.label configure -text $number
	after 1000 {inc}
}

label .label -text $number
pack .label -fill x

button .b -text Quit -command exit
pack .b -fill x

inc

ruby/Tk


#!/usr/local/bin/ruby

require "tk"

$number = 0

def inc
  if $number < 10
	$number += 1
  else
	$number = 1
  end
  $label.configure('text', $number)
  Tk.after 1000, proc{inc}
end

$label = TkLabel.new {
  text $number
  pack('fill' => 'x')
}

TkButton.new {
  text 'Quit'
  command 'exit'
  pack('fill' => 'x')
}

inc

Tk.mainloop