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 | 4c3328f5476f54c84b1f048eed075e6edf5e5b1d (patch) | |
tree | 92b661314bdfd045882e365e3e43b77f57244725 /ext/tk/sample/safe-tk.rb | |
parent | d7bdf5df56f337d8ca1152598ff138703896c54b (diff) |
* (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: svn+ssh://ci.ruby-lang.org/ruby/trunk@4282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/safe-tk.rb')
-rw-r--r-- | ext/tk/sample/safe-tk.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/tk/sample/safe-tk.rb b/ext/tk/sample/safe-tk.rb index 6b6de8f848..8be13a32d0 100644 --- a/ext/tk/sample/safe-tk.rb +++ b/ext/tk/sample/safe-tk.rb @@ -32,6 +32,7 @@ cmd = Proc.new{|txt| timer = TkTimer.new(50, -1, tick).start(0, proc{ label.text('0.00'); 0 }) +=begin TkButton.new(:text=>'Start') { command proc{ timer.continue unless timer.running? } pack(:side=>:left, :fill=>:both, :expand=>true) @@ -44,6 +45,30 @@ cmd = Proc.new{|txt| command proc{ timer.stop if timer.running? } pack('side'=>'right','fill'=>'both','expand'=>'yes') } +=end + b_start = TkButton.new(:text=>'Start', :state=>:disabled) { + pack(:side=>:left, :fill=>:both, :expand=>true) + } + b_stop = TkButton.new(:text=>'Stop', :state=>:normal) { + pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes') + } + + b_start.command { + timer.continue + b_stop.state(:normal) + b_start.state(:disabled) + } + + b_stop.command { + timer.stop + b_start.state(:normal) + b_stop.state(:disabled) + } + + TkButton.new(:text=>'Reset', :state=>:normal) { + command { timer.reset } + pack('side'=>'right', 'fill'=>'both', 'expand'=>'yes') + } ev_quit = TkVirtualEvent.new('Control-c', 'Control-q') Tk.root.bind(ev_quit, proc{Tk.exit}).focus |