On 5/9/05, Joe Van Dyk <joevandyk / gmail.com> wrote:
> On 5/8/05, Joe Van Dyk <joevandyk / gmail.com> wrote:
> >
> > Thanks for the info.  I'll see if I can get those Tk extensions installed.
> >
> 
> Ok, got the TkTable extensions installed and can run the TkTable Ruby
> demos!  Hooray.
> 
> I'm not sure how to do the following though:
> 
> I have a Hash of Players.  Each Player has a Hash called attribute_list.
> 
> I want to display each player's attribute list in the TkTable.
> 
> So, given the following class and code, how could I display its data
> in the TkTable?
> 
> class Player
>   attr_accessor attribute_list
>   def initialize
>     @attribute_list = {}
>     @attribute_list[:player_id] = rand(100).to_s
>     @attribute_list[:x_position] = rand(100).to_s
>     @attribute_list[:y_position] = rand(100).to_s
>   end
> end
> 
> players = []
> 3.times { players.push(Players.new) }
> 
> The resulting table would look something like (view in fixed font):
> 
> ---------------------------------------
> | player_id | x_position | y_position |
> ---------------------------------------
> | 24        | 56         | 34         |
> | 63        | 88         | 83         |
> | 12        | 35         | 89         |
> ---------------------------------------
> 
> Would you use the :command feature of TkTable to do this?
> 
> Thanks,
> Joe
> 

I figured it out.  The way that worked for me was to use the :variable
key when creating the TkTable (and connect it to a TkVariable hash).

Another question!  Does anyone know how to scale a Tk canvas image?

Thanks,
Joe