S
Sujeet Kumar
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
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