require 'tk' name = '' TkLabel.new(nil, 'text'=>'Put your name below.').pack entry = TkEntry.new.pack TkButton.new(nil, 'text'=>'OK', 'command'=>proc{ name = entry.value; TkRoot.new.destroy }).pack Tk.mainloop puts "Hello, #{name}"