require 'tk' def warning( msg ) ret_value = TkWarning.new('Watch out!!').value msg.text( ret_value ) end msg = TkMessage.new.pack TkButton.new(nil, 'text'=>'show warning', 'command'=>proc{ warning(msg) }).pack Tk.mainloop