How to change the status of an checkbutton

Hi all,

I am new to GUI/TK. I just create a checkbutton and set the default
status
to select. I am able to get the default status of it. Here is the
script:

checkbutton1=TkCheckButton.new() {
text “automode”
relief “groove”
command (select)
pack
}
puts checkbutton1.get_value# which is 1

But when I uncheck it, I get the following error message and the return
value is still 1. How can I add some lines to make sure that it is
capable of “uncheck” and returns the correct value, which is 0 if
“uncheck”?

Thanks,

####error message###
NameError: unknown option ‘call’ for #<Tk::CheckButton:0x000000045c59a0
@path=".w00004"> (deleted widget?)
—< backtrace of Ruby side >-----
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:4988:in rescue in method_missing' C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:4984:inmethod_missing’
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1456:in eval_cmd' C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1456:incb_eval’
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1403:in call' C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1599:inblock in callback’
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1598:in catch' C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1598:incallback’
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1305:in mainloop' C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1305:inblock in module:TkCore
—< backtrace of Tk side >-------
invoked from within
“rb_out c00001”
invoked from within
“.w00004 invoke”
(“uplevel” body line 1)
invoked from within
“uplevel #0 [list $w invoke]”
(procedure “tk::ButtonUp” line 24)
invoked from within
“tk::ButtonUp .w00004”
(command bound to event)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs