From: Sujeet Kumar Date: 2005-05-29T23:22:31+09:00 Subject: Calling class's method when button is pressed Hi How to call the method of a class when button(TkButton) is pressed. For example why the following code generate runtime error bgerror failed to handle background error. Original error: NoMethodError: undefined method `bpressed' for Button:Class Error in bgerror: invoked "break" outside of a loop when TkButton is pressed.The code is require 'tk' class Button def bpressed puts "bpressed" end root = TkRoot.new(){ title "Buttton"} button =TkButton.new(root){ text "Button1" command {Button::bpressed} }.pack end Tk.mainloop Anyone can explain the error or any other method to call class's function when TkButton is pressed Thanks sujeet