Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby/Tk grid

Reply
Thread Tools

Ruby/Tk grid

 
 
Ftf 3k3
Guest
Posts: n/a
 
      06-12-2009
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/.

 
Reply With Quote
 
 
 
 
Hidetoshi NAGAI
Guest
Posts: n/a
 
      06-12-2009
From: Ftf 3k3 <>
Subject: Ruby/Tk grid
Date: Fri, 12 Jun 2009 23:10:23 +0900
Message-ID: <>
> 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 ()

 
Reply With Quote
 
 
 
 
Ftf 3k3
Guest
Posts: n/a
 
      06-13-2009
Thanks this was helpful, I did my first Tk interface.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a container to hold grid positions and the objects on the grid? Simon L C++ 3 03-31-2006 03:38 PM
Grouped grid? Or grid within datalist? Danny Tuppeny ASP .Net 1 10-27-2005 10:03 PM
How to transfer a value from an Invisible Grid to an visible Grid =?Utf-8?B?QXNzYW5LaGFuIElzbWFpbA==?= ASP .Net 2 10-17-2005 03:56 AM
Grid within a Grid ItemDataBound event problem Girish ASP .Net 4 07-19-2005 01:17 AM
Grid question: How do I force grid elements to expand and use available space Marc Python 0 10-08-2003 05:06 PM



Advertisments