- 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
- #该片段来自于http://www.codesnippet.cn/detail/110320132367.html
来源: http://www.codesnippet.cn/detail/110320132367.html