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