Tk - list all options available for configure()

Rubies:

Me again, droning about Ruby/Tk again.

The equivalent of the following code…

canvas = TkCanvas.new(top) {width(400);height(300) }
p canvas.configure()

…if written in Python (boo! hiss!) Tkinter, would print out all the
configuration options.

Similarily, canvas.cget() without an argument would return an entire map of
configuration names and values.

I can’t find the equivalents in Ruby/Tk - despite being an overwhelmingly
better language and Tk wrapper.

How do we squeeze even more self-documentation out of these objects?

···


Phlip
http://www.c2.com/cgi/wiki?TestFirstUserInterfaces

In article bb9dd1$fbv@dispatch.concentric.net,

Rubies:

Me again, droning about Ruby/Tk again.

The equivalent of the following code…

canvas = TkCanvas.new(top) {width(400);height(300) }
p canvas.configure()

…if written in Python (boo! hiss!) Tkinter, would print out all the
configuration options.

Is it just that it returns a hash (er… dictionary) and prints all the
keys or something?

Similarily, canvas.cget() without an argument would return an entire map of
configuration names and values.

I can’t find the equivalents in Ruby/Tk - despite being an overwhelmingly
better language and Tk wrapper.

How do we squeeze even more self-documentation out of these objects?

Interesting idea. I’ve been playing a lot with Ruby/Tk the last week or
so and I know that I would like to see some more comprehensive docs. I
think the basics are covered pretty well, but some of the more obscure
corners aren’t. (For example, I’d really like to find a reliable way to
limit scrolling of a canvas to a particular region.) Mostly I’ve had to
use google to find stuff on Perl/Tk sites and then translate (though,
that’s not always straightforward ). It’s been a lot of trial-and-error
which has made progress slow.

Phil

···

Phlip phlipcpp@yahoo.com wrote:

Hi,

···

From: “Phlip” phlipcpp@yahoo.com
Subject: Tk - list all options available for configure()
Date: Sat, 31 May 2003 14:15:21 +0900
Message-ID: bb9dd1$fbv@dispatch.concentric.net

canvas = TkCanvas.new(top) {width(400);height(300) }
p canvas.configure()

…if written in Python (boo! hiss!) Tkinter, would print out all the
configuration options.

In this case, please use canvas.configinfo().
On Ruby/Tk, to query the configuration options,
use one of the following methods.

(1) widget[option] #==> canvas[‘width’]
(2) widget.cget(option) #==> canvas.cget(‘width’)
(3) widget.option #==> canvas.width
(4) widget.configinfo(option) #==> canvas.configinfo(‘width’)
(5) widget.configinfo #==> canvas.configinfo

To modify the options,

(1) widget[option] = value #==> canvas[‘width’] = 400
(2) widget.option(value) #==> canvas.width = 400
(3) widget.configure(option, value) #==> canvas.configure(‘width’, 400)
(4) widget.configure(Hash) #==> canvas.configure(‘width’=>400,
‘height’=>300)

                              Hidetoshi Nagai (nagai@ai.kyutech.ac.jp)