summaryrefslogtreecommitdiff
path: root/ext/tcltklib/demo
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-01 16:09:54 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-01 16:09:54 +0000
commitf1c3638777c89f9b085ba0aa3863e3f5691154e3 (patch)
tree795f5cae59103ce5b7fc91cfd3d706ee7a746ba2 /ext/tcltklib/demo
parent9857d6c5462ce5a0a9194b85937d977fc042323a (diff)
* renewal Ruby/Tk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tcltklib/demo')
-rw-r--r--ext/tcltklib/demo/lines1.rb26
-rw-r--r--ext/tcltklib/demo/lines2.rb26
2 files changed, 26 insertions, 26 deletions
diff --git a/ext/tcltklib/demo/lines1.rb b/ext/tcltklib/demo/lines1.rb
index e459589f50..9f21ae6377 100644
--- a/ext/tcltklib/demo/lines1.rb
+++ b/ext/tcltklib/demo/lines1.rb
@@ -1,6 +1,6 @@
#! /usr/local/bin/ruby
-require "tk"
+require "tcltk"
def drawlines()
print Time.now, "\n"
@@ -14,7 +14,7 @@ def drawlines()
col = "red"
end
for i in 0 .. 99
-# TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
+# $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
end
end
@@ -29,26 +29,22 @@ def drawlines()
col = "red"
end
for i in 0 .. 99
- TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
+ $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
end
end
print Time.now, "\n"
-# Tk.root.destroy
+# $ip.commands()["destroy"].e($root)
end
-$a = TkCanvas.new{
- height(500)
- width(500)
-}
+$ip = TclTkInterpreter.new()
+$root = $ip.rootwidget()
+$a = TclTkWidget.new($ip, $root, "canvas", "-height 500 -width 500")
+$c = TclTkCallback.new($ip, proc{drawlines()})
+$b = TclTkWidget.new($ip, $root, "button", "-text draw -command", $c)
-$b = TkButton.new{
- text("draw")
- command(proc{drawlines()})
-}
+$ip.commands()["pack"].e($a, $b, "-side left")
-TkPack.configure($a, $b, {"side"=>"left"})
-
-Tk.mainloop
+TclTk.mainloop
# eof
diff --git a/ext/tcltklib/demo/lines2.rb b/ext/tcltklib/demo/lines2.rb
index 9f21ae6377..e459589f50 100644
--- a/ext/tcltklib/demo/lines2.rb
+++ b/ext/tcltklib/demo/lines2.rb
@@ -1,6 +1,6 @@
#! /usr/local/bin/ruby
-require "tcltk"
+require "tk"
def drawlines()
print Time.now, "\n"
@@ -14,7 +14,7 @@ def drawlines()
col = "red"
end
for i in 0 .. 99
-# $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
+# TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
end
end
@@ -29,22 +29,26 @@ def drawlines()
col = "red"
end
for i in 0 .. 99
- $a.e("create line", i, 0, 0, 500 - i, "-fill", col)
+ TkcLine.new($a, i, 0, 0, 500 - i, "-fill", col)
end
end
print Time.now, "\n"
-# $ip.commands()["destroy"].e($root)
+# Tk.root.destroy
end
-$ip = TclTkInterpreter.new()
-$root = $ip.rootwidget()
-$a = TclTkWidget.new($ip, $root, "canvas", "-height 500 -width 500")
-$c = TclTkCallback.new($ip, proc{drawlines()})
-$b = TclTkWidget.new($ip, $root, "button", "-text draw -command", $c)
+$a = TkCanvas.new{
+ height(500)
+ width(500)
+}
-$ip.commands()["pack"].e($a, $b, "-side left")
+$b = TkButton.new{
+ text("draw")
+ command(proc{drawlines()})
+}
-TclTk.mainloop
+TkPack.configure($a, $b, {"side"=>"left"})
+
+Tk.mainloop
# eof