Hi
I am new to Ruby.When I run the following command it gives runtime
error on pressing Button.Error is
____________________________________________________________
bgerror failed to handle background error.
Original error: NoMethodError: undefined method `bpressed' for
Button:Class
Error in bgerror: invoked "break" outside of a loop
_________________________________________________________
Basically I want when the button is pressed it calls some method of class.
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
Plz reply how to call function bpressed when button is pressed.
Thanks
sujeet