diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
| commit | 01d614d05fa34345e9c8e1521684984aaaa05658 (patch) | |
| tree | 92b661314bdfd045882e365e3e43b77f57244725 /ext/tk/sample/demos-jp/timer | |
| parent | e3689350394195b3d82013f58a586d5f461cc6b8 (diff) | |
| download | ruby-01d614d05fa34345e9c8e1521684984aaaa05658.tar.gz ruby-01d614d05fa34345e9c8e1521684984aaaa05658.tar.xz ruby-01d614d05fa34345e9c8e1521684984aaaa05658.zip | |
* (bug fix) TkEntry#delete
* (bug fix) some widget demos
* support <TkVariable object> == <Symbol>
( "coerce TkVariable" add to the TODO list :-) )
* freeze some object for security reason
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/timer')
| -rw-r--r-- | ext/tk/sample/demos-jp/timer | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ext/tk/sample/demos-jp/timer b/ext/tk/sample/demos-jp/timer index 232f4ae5c..58a41d00c 100644 --- a/ext/tk/sample/demos-jp/timer +++ b/ext/tk/sample/demos-jp/timer @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby # # timer -- # This script generates a counter with start,stop and reset buttons. @@ -80,12 +80,28 @@ end class ButtonFrame < TkFrame def initialize(parent=nil,keys=nil) super(parent,keys) +=begin @stop = TkButton.new(self, 'text'=>'Stop', 'command'=>proc{timer_stop}) @start = TkButton.new(self, 'text'=>'Start', 'command'=>proc{timer_start}) +=end + @stop = TkButton.new(self, :text=>'Stop', :state=>:disabled) + @start = TkButton.new(self, :text=>'Start', :state=>:normal) + + @stop.command proc{ + timer_stop + @start.state(:normal) + @stop.state(:disabled) + } + @start.command proc{ + timer_start + @stop.state(:normal) + @start.state(:disabled) + } + @reset = TkButton.new(self, 'text'=>'Reset', 'command'=>proc{timer_reset}) @@ -99,8 +115,8 @@ end class Timer < TkRoot attr_reader :countframe - def initialize - super + def initialize(*args) + super(*args) @countframe = CountFrame.new(self) @buttonframe = ButtonFrame.new(self) for f in [@buttonframe,@countframe] |
