summaryrefslogtreecommitdiff
path: root/test/ruby/tk-calc.in.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2006-02-22 13:48:59 +0000
committermurphy <murphy@rubychan.de>2006-02-22 13:48:59 +0000
commit3b4a0d83ddd0eec0dc424798ad8ed3a53c5ba88c (patch)
treee764725fda5393480312babf3797da0c94d5c29f /test/ruby/tk-calc.in.rb
parent340013c50581fc2c471bee1517d001e1f74bd87a (diff)
downloadcoderay-3b4a0d83ddd0eec0dc424798ad8ed3a53c5ba88c.tar.gz
New Test: test/ruby/tk-calc.in.rb.
Thanks to mawe.
Diffstat (limited to 'test/ruby/tk-calc.in.rb')
-rw-r--r--test/ruby/tk-calc.in.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/tk-calc.in.rb b/test/ruby/tk-calc.in.rb
new file mode 100644
index 0000000..76272da
--- /dev/null
+++ b/test/ruby/tk-calc.in.rb
@@ -0,0 +1,5 @@
+require 'tk';TkRoot.new;r,c,b=1,1,%w#7 8 9 + 4 5 6 - 1 2 3 * 0 . /#;d=TkEntry.new{
+grid("row"=>0,"column"=>1,"columnspan"=>4)};b.each_index{|i|TkButton.new{text b[i]
+command proc{d.insert("end",b[i])};grid("row"=>r,"column"=>c)};c+=1;if i&&(i+1)%##
+4==0then r+=1;c=1 end};TkButton.new{text"=";command proc{t=d.get;d.delete(0,"end")
+d.insert("end",eval(t))};grid("row"=>r,"column"=>c)};Tk.mainloop### by mawe :) ###