From: Hidetoshi NAGAI Date: 2010-12-08T08:17:57+09:00 Subject: Re: tk widget: variable or textvariable From: "Martin C." Subject: tk widget: variable or textvariable Date: Wed, 8 Dec 2010 04:27:22 +0900 Message-ID: <36c3d1aafd4a8f769d4030cc99a4515c@ruby-forum.com> > In Ruby/Tk, is there an easy way to check whether a widget supports > setting variable or textvariable? respond_to? does not work. 1. catch RuntimeError on TkWindow#cget or TkWindow#[] or TkWindow#configinfo. If raised, the widget doesn't support the option. 2. check keys of a Hash returned by TkWindow.current_configinfo. e.g. TkButton.new.current_configinfo.keys.find{|opt| opt =~ /variable/} -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Department of Artificial Intelligence, Kyushu Institute of Technology