HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.3.8/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb
#!/usr/bin/env ruby
# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'

mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic,
                                  :labeltext=>'Messages', :labelpos=>:n,
                                  :height=>120, :width=>550,
                                  :savedir=>'/tmp', :textbackground=>'#d9d9d9')
mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true)

mb.type_add('ERROR', :background=>'red', :foreground=>'white', :bell=>true)
mb.type_add('WARNING', :background=>'yellow', :foreground=>'black')
mb.type_add('INFO', :background=>'white', :foreground=>'black')

mb.issue('This is an error message in red with a beep', 'ERROR')
mb.issue('This warning message in yellow', 'WARNING')
mb.issue('This is an informational message', 'INFO')

Tk.mainloop