Trying to get back into Tk

After a hiatus of many years, I’m trying to get back into Tk via Ruby.
Unfortunately, my first attempt–a simple text box with attached
scroll bar–doesn’t work very well. The scroll bar doesn’t show up,
and the text box only gets so large; past that point, enlarging the
window doesn’t enlarge the text box. I’ve copied in my code, and would
greatly appreciate it if someone could tell me where I’m going wrong.
It’s been a long time since using Tk, and I’ve never used it with Ruby.

Thanks,
Ken

require ‘tk’

ROOT = TkRoot.new {title ‘WIN’}
FRAME = TkFrame.new(ROOT)

TEXT = TkText.new(FRAME) {
pack ‘side’ => ‘left’, ‘fill’ => ‘both’, ‘expand’ => ‘true’
}
YSCROLL = TkScrollbar.new(FRAME) do command {
|first, last| TEXT.yview first, last
pack ‘side’ => ‘right’, ‘fill’ => ‘y’
}
end
TEXT.yscrollcommand {|first, last| YSCROLL.set(first, last) }
FRAME.pack
Tk.mainloop

From: Kenneth McDonald [email protected]
Subject: Trying to get back into Tk
Date: Wed, 3 Dec 2008 05:42:41 +0900
Message-ID: [email protected]

YSCROLL = TkScrollbar.new(FRAME) do command {
|first, last| TEXT.yview first, last
pack ‘side’ => ‘right’, ‘fill’ => ‘y’
^^^ Here is the reason of your trouble.
}
end

The ‘pack’ method call is written in the callback of the scrollbar.
You have to write it at external of the callback.
For example,