[Tutor] Documentation

Andre Roberge andre.roberge at gmail.com
Mon Feb 6 04:08:03 CET 2006


On 2/5/06, Paul Kraus <pkraus at pelsupply.com> wrote:
> > >>> help(Tkinter.Button.configure)
> >
> > Help on method configure in module Tkinter:
> >
> > configure(self, cnf=None, **kw) unbound Tkinter.Button method
> >     Configure resources of a widget.
> >
> >     The values for resources are specified as keyword
> >     arguments. To get an overview about
> >     the allowed keyword arguments call the method keys.
> >
> >
> > Try it on your own!  As a rule, stay away from methods that start with
> > an underscore.
> Thanks for the fast response. This was exactly what I was looking for. One
> last question how would I 'call the method keys'. from the example above.

To be honest ... I don`t know.  I don't use Tkinter myself.  Here's
what I get from the help function:
---------
>>> help(Tkinter.Button.keys)
Help on method keys in module Tkinter:

keys(self) unbound Tkinter.Button method
    Return a list of all resource names of this widget.
-------
So, I would guess that, after creating a button, through something like
aButton = Button(parent, text="Some label", command=some_action)

You could do:
resources = aButton.keys()

There is a free book on using Tkinter to be found at
http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html

Another great resource is to be found on
http://www.pythonware.com/library/index.htm

You will find there a Tkinter reference book on-line (html version) or
a downloadable one (pdf).  Here's what I found by browsing...
===========
The following dictionary method also works for widgets:

keys() => list

    Return a list of all options that can be set for this widget. The
name option is not included in this list (it cannot be queried or
modified through the dictionary interface anyway, so this doesn't
really matter).
===========

You may have to wait until tomorrow to get your answer, when the "real
tutors" are online ;-)

Good luck!

André


More information about the Tutor mailing list