Hi all,
I want to return the info of some widgets in a 2-D grid.
I copy some example codes from the website:
TkDocs Tutorial - The Grid Geometry Manager.
and it runs OK.
But when I add this line to the end of this script( before Tk.mainloop)
TkGrid.slaves(content, nil)
Ruby complains and shows the following error message:
C:/Ruby200-x64/lib/ruby/2.0.0/tk/grid.rb:248:in slaves': undefined local variable or method
args’ for TkGrid:Module (NameError)
I also read the documents about Grid.slaves on ruby-doc website:
but I don’t see any further useful information.
I wonder if there is a bug for TkGrid:Module.
Thank you for any comments.
require ‘tk’
require ‘tkextlib/tile’
root = TkRoot.new
content = Tk::Tile::Frame.new(root)
frame = Tk::Tile::Frame.new(content) {borderwidth 5; relief “sunken”;
width 200; height 100}
namelbl = Tk::Tile::Label.new(content) {text “Name”}
name = Tk::Tile::Entry.new(content)
$option_one = TkVariable.new( 1 )
one = Tk::Tile::CheckButton.new(content) {text “One”; variable
$option_one; onvalue 1}
$option_two = TkVariable.new( 0 )
two = Tk::Tile::CheckButton.new(content) {text “Two”; variable
$option_two; onvalue 1}
$option_three = TkVariable.new( 1 )
three = Tk::Tile::CheckButton.new(content) {text “Three”; variable
$option_three; onvalue 1}
ok = Tk::Tile::Button.new(content) {text “Okay”}
cancel = Tk::Tile::Button.new(content) {text “Cancel”}
content.grid :column => 0, :row => 0
frame.grid :column => 0, :row => 0, :columnspan => 3, :rowspan => 2
namelbl.grid :column => 3, :row => 0, :columnspan => 2
name.grid :column => 3, :row => 1, :columnspan => 2
one.grid :column => 0, :row => 3
two.grid :column => 1, :row => 3
three.grid :column => 2, :row => 3
ok.grid :column => 3, :row => 3
cancel.grid :column => 4, :row => 3
TkGrid.slaves(content, nil)#####Ruby complains this line
Tk.mainloop