mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* renewal Ruby/Tk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9857d6c546
commit
f1c3638777
132 changed files with 7836 additions and 11515 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue