Callbacks Blocks can be used to as callbacks. No need to define separate function/method. require 'tk' # create a button b = TkButton.new(:text => "hello").pack # specify a callback for button-push event b.command { puts "hello" } # start event loop Tk.mainloop