tkinter docs?

Doug Hellmann doughellmann at mindspring.com
Tue May 11 16:44:41 EDT 1999


narf at golden.net wrote:
> 
> I am looking for complete tkinter docs

For documentation on Tkinter, you should check out the python home page
for a list of links:  http://www.python.org/topics/tkinter

There are several good reference sites listed on that page.  For some of
the Tk documentation, it helps if you know Tcl (enough of which I
learned to make sense of the docs).  I also recommend _Practical
Programming in Tcl and Tk_ by Brent Welch if you are looking for
hardcopy.  It has some pretty good coverage of Tk as a whole.

> specifically I want to make a text area, or Pmw.SrolledText area be a
> certain dimension, however generic instructions how to get all tkinter/pmw
>  widgets to be sized as I desire, would be appreciated

For a straight Tkinter text widget, use the width and height attributes
to control the dimensions.  The units are characters and lines
respectively, and the values can be set when the widget is created or
via a call to the configure method.

For a Pmw.ScrolledText widget, you want to specify the width or height
of the 'text' component of the composite widget.  To do that, you can
set the attribute of the text component during creation or through a
configure call to the composite with the syntax:

	widget.configure(<component>_<attribute>=<value>)

For example:

	myScrolledText.configure(text_height=15)

will give you a 15 line high scrolled text area.  This syntax becomes
*really* fun when you start creating composite widgets made up of other
composite widgets.

I haven't tried it, but you might also be able to configure the
component widget directly with a call like:

	myScrolledText.component('text').configure(height=15)

Although even if that worked it would introduce extra complexity to your
code.  I don't believe it would affect efficiency, just readability.

Good luck,
Doug




More information about the Python-list mailing list