>>>>> "W" == WmLi  <WmLi / ThoughtWorks.com> writes:

W> The display change to a row of labels. Could anyone tell me what's the
W> difference between the two ways of calling pack.

 The problem is that it exist only way one to call pack :-)

 #pack is a method which must be called with an hash as argument, like when
  you write 

 pack( 'side' => 'left', 'padx' => 5, 'pady' => 5 )

 When you call

          pack { side 'left'; padx  5; pady  5 }

 this is like when you write

         pack() { side 'left'; padx  5; pady  5 }

 i.e. #pack is called with 0 arguments, and as an iterator (we have given a
 block to #pack) but #pack don't use this block. This is why it give you
 all default values.

 This is different from #new which can be called as a normal method,
 i.e. you can write

     f = TkFrame.new(root)
     f.borderwidth 2
     f.relief relief
     f.pack ( 'side' => 'left', 'padx' => 5, 'pady' => 5 )

 or like an iterator (this is your example), in this case
 rb_obj_instance_eval() is called for the block given to #new


Guy Decoux