From: Hidetoshi NAGAI Date: 2009-06-13T08:58:17+09:00 Subject: Re: Ruby/Tk grid From: Ftf 3k3 Subject: Ruby/Tk grid Date: Fri, 12 Jun 2009 23:10:23 +0900 Message-ID: <89d6d9e03593b2685c005e86e5ec618f@ruby-forum.com> > I want a 23*36 grid and the ability to put widgets at a specified > location (row/column). I've been searching for a while now and I still > can't find any clear documentation. For example, ---------------------------------------------------------------------- require 'tk' base = TkFrame.new.pack(:expand=>true, :fill=>:both) TkGrid.rowconfigure(base, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(base, 0, 'weight'=>1, 'minsize'=>0) c = TkCanvas.new(base).grid(:row=>0, :column=>0, :sticky=>'news') c.xscrollbar TkScrollbar.new(base).grid(:row=>1, :column=>0, :sticky=>'ew') c.yscrollbar TkScrollbar.new(base).grid(:row=>0, :column=>1, :sticky=>'ns') cwin = TkcWindow.new(c, [0, 0], :window=>(f = TkFrame.new(c)), :anchor=>:nw) f.bind('Configure'){ c.scrollregion = cwin.bbox } 23.times{|x| 36.times{|y| TkButton.new(f,:text=>"#{x}x#{y}").grid(:column=>y,:row=>x,:sticky=>'news') } } Tk.mainloop ---------------------------------------------------------------------- -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)