diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-07 16:53:56 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-07 16:53:56 +0000 |
commit | 231e7ac939453e6e2daac2cc7beaaf946dbd995d (patch) | |
tree | f6f39cf1a88acbbcece527fd6839583e005348fc /ext/tk/sample/demos-en/goldberg.rb | |
parent | 051399c46fac8cc7ed9cb5f3cc6a063ee96ea6f8 (diff) | |
download | ruby-231e7ac939453e6e2daac2cc7beaaf946dbd995d.tar.gz |
* sample/tkextlib/treectrl/*.rb: fixed typo. (wrong itemheight)
* sample/demos-{en,jp}/goldberg.rb: reduced canvas size. [ruby-dev:25992]
(written by Hidetoshi NAGAI)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-en/goldberg.rb')
-rw-r--r-- | ext/tk/sample/demos-en/goldberg.rb | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb index dd1d979025..8d3f6d14f7 100644 --- a/ext/tk/sample/demos-en/goldberg.rb +++ b/ext/tk/sample/demos-en/goldberg.rb @@ -54,6 +54,7 @@ $goldberg_demo = TkToplevel.new {|w| # positionWindow(w) } +=begin # label msg = TkLabel.new($goldberg_demo) { font 'Arial 10' @@ -62,7 +63,9 @@ msg = TkLabel.new($goldberg_demo) { text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg" } msg.pack('side'=>'top') +=end +=begin # frame TkFrame.new($goldberg_demo) {|frame| TkButton.new(frame) { @@ -80,6 +83,7 @@ TkFrame.new($goldberg_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') +=end ######################################### @@ -159,7 +163,7 @@ class TkGoldberg_Demo :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>860, :height=>730, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -171,9 +175,34 @@ class TkGoldberg_Demo do_ctrl_frame do_detail_frame - @show = TkButton.new(@parent, :text=>'>>', :command=>proc{show_ctrl}, + msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') { + font 'Arial 10' + wraplength 600 + justify 'left' + text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg" + } + msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw) + + frame = TkFrame.new(@parent, :bg=>@C['bg']) + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text 'Dismiss' + command proc{ + tmppath = $goldberg_demo + $goldberg_demo = nil + tmppath.destroy + } + }.pack('side'=>'left') + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text 'See Code' + command proc{showCode 'goldberg'} + }.pack('side'=>'left', 'padx'=>5) + + @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) - @show.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) + @show.pack('side'=>'left') + frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) Tk.update end @@ -364,7 +393,9 @@ class TkGoldberg_Demo end def about - msg = "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n" + msg = "Ruby/Tk Version ::\nby Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)\n\n" + msg += "Original Version ::\n" + msg += "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n" msg += "Man will always find a difficult means to perform a simple task" msg += "\nRube Goldberg" Tk.messageBox(:message=>msg, :title=>'About') @@ -1748,7 +1779,7 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 755, :anchor=>:s, :tag=>'I26', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', :text=>'click to continue', :font=>['Times Roman', 24, :bold]) @canvas.bind('1', proc{reset}) |