tk widget: variable or textvariable

M

Martin C.

In Ruby/Tk, is there an easy way to check whether a widget supports
setting variable or textvariable? respond_to? does not work.
 
H

Hidetoshi NAGAI

From: "Martin C." <[email protected]>
Subject: tk widget: variable or textvariable
Date: Wed, 8 Dec 2010 04:27:22 +0900
Message-ID: said:
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/}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top