Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #6984
| X-Received | by 10.236.162.9 with SMTP id x9mr11804125yhk.17.1401720136483; Mon, 02 Jun 2014 07:42:16 -0700 (PDT) |
|---|---|
| X-Received | by 10.182.75.133 with SMTP id c5mr17884obw.30.1401720136315; Mon, 02 Jun 2014 07:42:16 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!hw13no3620364qab.0!news-out.google.com!qf4ni17772igc.0!nntp.google.com!c1no22304662igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.ruby |
| Date | Mon, 2 Jun 2014 07:42:16 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=140.254.45.32; posting-account=RfFTqAoAAACrAXIMizuNGmxWCtZu7Zn- |
| NNTP-Posting-Host | 140.254.45.32 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <23f95ed8-7cd2-4170-8515-e1a834533aa7@googlegroups.com> (permalink) |
| Subject | how to change the status of a checkbutton interactively |
| From | chen1069osu@gmail.com |
| Injection-Date | Mon, 02 Jun 2014 14:42:16 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Received-Bytes | 2846 |
| X-Received-Body-CRC | 3647651460 |
| Xref | csiph.com comp.lang.ruby:6984 |
Show key headers only | View raw
Hi all,
I am new to tk. I try to build a simple GUI with several widgets following the tutorials from this website:http://www.tkdocs.com/tutorial/widgets.html#checkbutton
One of the widgets I copy from website is checkbutton as following:
require 'tk'
require 'tkextlib/tile'
root = TkRoot.new {title "Feet to Meters"}
$measureSystem = TkVariable.new
check = Tk::Tile::CheckButton.new(root) {
text 'Use Metric';
command 'metricChanged';
variable $measureSystem;
onvalue 'metric';
offvalue 'imperial';
pack
}
Tk.mainloop
when I check the checkbutton, I get an error message as following:
NameError: undefined local variable or method `metricChanged' for main:Object
---< backtrace of Ruby side >-----
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1456:in `cb_eval'
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:in `cb_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:in `block 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:in `callback'
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1305:in `mainloop'
C:/Ruby200-x64/lib/ruby/2.0.0/tk.rb:1305:in `block in <module:TkCore>'
---< backtrace of Tk side >-------
invoked from within
"rb_out c00001"
invoked from within
".w00000 invoke "
invoked from within
".w00000 instate !disabled { .w00000 invoke } "
invoked from within
".w00000 instate pressed { .w00000 state !pressed; .w00000 instate !disabled { .w00000 invoke } } "
(command bound to event)
so my question is that why this happens? How come I cannot set the check or uncheck from user end or set its status interactively?
Thank you so much in advance for your help.
Back to comp.lang.ruby | Previous | Next | Find similar
how to change the status of a checkbutton interactively chen1069osu@gmail.com - 2014-06-02 07:42 -0700
csiph-web