Ruby/Tk grid

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.

Can somebody help please?
Regards

···

--
Posted via http://www.ruby-forum.com/.

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,

···

From: Ftf 3k3 <ftf3k3@gmail.com>
Subject: Ruby/Tk grid
Date: Fri, 12 Jun 2009 23:10:23 +0900
----------------------------------------------------------------------
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)

Thanks this was helpful, I did my first Tk interface.

···

--
Posted via http://www.ruby-forum.com/.