1#!/usr/bin/env ruby 2require 'tk' 3require 'tkextlib/iwidgets' 4 5mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, 6 :labeltext=>'Messages', :labelpos=>:n, 7 :height=>120, :width=>550, 8 :savedir=>'/tmp', :textbackground=>'#d9d9d9') 9mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) 10 11mb.type_add('ERROR', :background=>'red', :foreground=>'white', :bell=>true) 12mb.type_add('WARNING', :background=>'yellow', :foreground=>'black') 13mb.type_add('INFO', :background=>'white', :foreground=>'black') 14 15mb.issue('This is an error message in red with a beep', 'ERROR') 16mb.issue('This warning message in yellow', 'WARNING') 17mb.issue('This is an informational message', 'INFO') 18 19Tk.mainloop 20