Tk - list all options available for configure() 
Author Message
 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.*-*-*.com/



Wed, 16 Nov 2005 13:08:49 GMT  
 Tk - list all options available for configure()

Quote:

>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?

Quote:

>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



Wed, 16 Nov 2005 13:58:39 GMT  
 Tk - list all options available for configure()
Hi,


Subject: Tk - list all options available for configure()
Date: Sat, 31 May 2003 14:15:21 +0900

Quote:
>   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)
--



Thu, 17 Nov 2005 00:32:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Geting list of alowed options of option command

2. Tk 4.1/Tk 4.2 configure bug for Unix

3. Build question: options for configure?

4. ./configure options

5. Problems with ./configure options (Python-2.1) on HPUX11 for 64bit ELF format

6. enabling options after /configure

7. Configure options not passed to base class

8. How to specify USE_PUTENV flag through configure option?

9. misleading option in configure

10. scrollbar configure options don't

11. --mandir option to configure doesn't work

12. How to remove (un-configure) an option

 

 
Powered by phpBB® Forum Software