1#!/usr/bin/env ruby 2require 'tk' 3require 'tkextlib/iwidgets' 4 5mainloop = Thread.new{Tk.mainloop} 6 7# 8# Standard question message dialog used for confirmation. 9# 10md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', 11 :text=>'Are you sure ? ', 12 :bitmap=>'questhead', :modality=>:global) 13 14md.buttonconfigure('OK', :text=>'Yes') 15md.buttonconfigure('Cancel', :text=>'No') 16 17if TkComm.bool(md.activate) 18 md.text('Are you really sure ? ') 19 if TkComm.bool(md.activate) 20 puts 'Yes' 21 else 22 puts 'No' 23 end 24else 25 puts 'No' 26end 27 28md.destroy 29 30# 31# Copyright notice with automatic deactivation. 32# 33bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm') 34 35cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', 36 :bitmap=>bmp, :imagepos=>:n, 37 :text=>"Copyright 200x XXX Corporation\nAll rights reserved") 38 39cr.hide('Cancel') 40 41cr.activate 42Tk.after(7000, proc{cr.deactivate; Tk.root.destroy}) 43 44mainloop.join 45