summaryrefslogtreecommitdiff
path: root/ruby_1_8_6/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb
blob: 808c798aecd18c16a539f4662402e9bd1815cf04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'

Thread.new{
  trap('INT') {puts 'catch SIGINT'}
  sleep 5
  trap('INT', 'DEFAULT')
}

Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, 
                        :width=>155, :height=>155){|w|
  w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true)
  # TkTimer.new(1000, -1, proc{w.show; Tk.update}).start
  TkTimer.new(25, -1, proc{w.show; Tk.update}).start
}

Tk.mainloop