Grid layout manager places its child widgets in a table-like arrangement : Layout « Tk « Ruby






Grid layout manager places its child widgets in a table-like arrangement


require 'tk'
root = TkRoot.new
3.times { |r|
  4.times { |c|
    TkLabel.new(root) {
      text "row #{r}, column #{c}"
    }.grid('row' => r, 'column' => c, 'padx' => 10, 'pady' => 10)
  }
}
Tk.mainloop

 








Related examples in the same category

1.Layout a label
2.To understand the use of row and column options
3.Place geometry manager
4.Pack option