#ruby

require 'tk'


root = TkRoot.new { title "Ex1" }

top = TkFrame.new(root)

label = TkLabel.new(top, 'text' => 'Hi There').pack( 'padx'=>15 , 'side' => 'top' )

lbl = TkLabel.new(top) { justify 'center'
  text    'Hello, World!';
  pack('padx'=>5, 'pady'=>5, 'side' => 'top') }
  
TkButton.new(top) {
  text "Cancel"
  command proc { lbl.configure('text'=>"Goodbye, Cruel World!") }
  pack('side'=>'right', 'padx'=>10, 'pady'=>10)
}

f=TkFrame.new(top,'width'=>500,'height'=>100,'background'=>'red').pack('side'=>'bottom')
f.grid_propagate(0)
f.pack_propagate(0)

    @back_label = TkLabel.new(f,'text'=>'Back').grid('row'=>0,'col'=>0,'sticky'=>'nw')
    @forw_label = TkLabel.new(f,'text'=>'Forw').grid('row'=>0,'col'=>2,'sticky'=>'se')
    @ok_label   = TkLabel.new(f,'text'=>'OK').grid('row'=>0,'col'=>1)

Tk.pack(top)

Tk.mainloop

