1: #!/usr/bin/env ruby 2: 3: require 'guicallback' 4: 5: gui_button = Button.new 6: gui_button.when_pressed { 7: puts "Someone pressed my button" 8: } 9: 10: # ... Some time later ... 11: gui_button.press
Someone pressed my button
(see guicallback.rb Source)