This commit was manufactured by cvs2svn to create tag 'r234c1'.
[python/dscho.git] / Doc / lib / tkinter.tex
blobe0c613f28aa083d6de6b0d78b85be2f68c8fb486
1 \chapter{Graphical User Interfaces with Tk \label{tkinter}}
3 \index{GUI}
4 \index{Graphical User Interface}
5 \index{Tkinter}
6 \index{Tk}
8 Tk/Tcl has long been an integral part of Python. It provides a robust
9 and platform independent windowing toolkit, that is available to
10 Python programmers using the \refmodule{Tkinter} module, and its
11 extension, the \refmodule{Tix} module.
13 The \refmodule{Tkinter} module is a thin object--oriented layer on top of
14 Tcl/Tk. To use \refmodule{Tkinter}, you don't need to write Tcl code,
15 but you will need to consult the Tk documentation, and occasionally
16 the Tcl documentation. \refmodule{Tkinter} is a set of wrappers that
17 implement the Tk widgets as Python classes. In addition, the internal
18 module \module{\_tkinter} provides a threadsafe mechanism which allows
19 Python and Tcl to interact.
21 Tk is not the only GUI for Python, but is however the most commonly
22 used one; see section~\ref{other-gui-modules}, ``Other User Interface
23 Modules and Packages,'' for more information on other GUI toolkits for
24 Python.
26 % Other sections I have in mind are
27 % Tkinter internals
28 % Freezing Tkinter applications
30 \localmoduletable
33 \section{\module{Tkinter} ---
34 Python interface to Tcl/Tk}
36 \declaremodule{standard}{Tkinter}
37 \modulesynopsis{Interface to Tcl/Tk for graphical user interfaces}
38 \moduleauthor{Guido van Rossum}{guido@Python.org}
40 The \module{Tkinter} module (``Tk interface'') is the standard Python
41 interface to the Tk GUI toolkit. Both Tk and \module{Tkinter} are
42 available on most \UNIX{} platforms, as well as on Windows and
43 Macintosh systems. (Tk itself is not part of Python; it is maintained
44 at ActiveState.)
46 \begin{seealso}
47 \seetitle[http://www.python.org/topics/tkinter/]
48 {Python Tkinter Resources}
49 {The Python Tkinter Topic Guide provides a great
50 deal of information on using Tk from Python and links to
51 other sources of information on Tk.}
53 \seetitle[http://www.pythonware.com/library/an-introduction-to-tkinter.htm]
54 {An Introduction to Tkinter}
55 {Fredrik Lundh's on-line reference material.}
57 \seetitle[http://www.nmt.edu/tcc/help/pubs/lang.html]
58 {Tkinter reference: a GUI for Python}
59 {On-line reference material.}
61 \seetitle[http://jtkinter.sourceforge.net]
62 {Tkinter for JPython}
63 {The Jython interface to Tkinter.}
65 \seetitle[http://www.amazon.com/exec/obidos/ASIN/1884777813]
66 {Python and Tkinter Programming}
67 {The book by John Grayson (ISBN 1-884777-81-3).}
68 \end{seealso}
71 \subsection{Tkinter Modules}
73 Most of the time, the \refmodule{Tkinter} module is all you really
74 need, but a number of additional modules are available as well. The
75 Tk interface is located in a binary module named \module{_tkinter}.
76 This module contains the low-level interface to Tk, and should never
77 be used directly by application programmers. It is usually a shared
78 library (or DLL), but might in some cases be statically linked with
79 the Python interpreter.
81 In addition to the Tk interface module, \refmodule{Tkinter} includes a
82 number of Python modules. The two most important modules are the
83 \refmodule{Tkinter} module itself, and a module called
84 \module{Tkconstants}. The former automatically imports the latter, so
85 to use Tkinter, all you need to do is to import one module:
87 \begin{verbatim}
88 import Tkinter
89 \end{verbatim}
91 Or, more often:
93 \begin{verbatim}
94 from Tkinter import *
95 \end{verbatim}
97 \begin{classdesc}{Tk}{screenName=None, baseName=None, className='Tk'}
98 The \class{Tk} class is instantiated without arguments.
99 This creates a toplevel widget of Tk which usually is the main window
100 of an appliation. Each instance has its own associated Tcl interpreter.
101 % FIXME: The following keyword arguments are currently recognized:
102 \end{classdesc}
104 Other modules that provide Tk support include:
106 \begin{description}
107 % \declaremodule{standard}{Tkconstants}
108 % \modulesynopsis{Constants used by Tkinter}
109 % FIXME
111 \item[\refmodule{ScrolledText}]
112 Text widget with a vertical scroll bar built in.
114 \item[\module{tkColorChooser}]
115 Dialog to let the user choose a color.
117 \item[\module{tkCommonDialog}]
118 Base class for the dialogs defined in the other modules listed here.
120 \item[\module{tkFileDialog}]
121 Common dialogs to allow the user to specify a file to open or save.
123 \item[\module{tkFont}]
124 Utilities to help work with fonts.
126 \item[\module{tkMessageBox}]
127 Access to standard Tk dialog boxes.
129 \item[\module{tkSimpleDialog}]
130 Basic dialogs and convenience functions.
132 \item[\module{Tkdnd}]
133 Drag-and-drop support for \refmodule{Tkinter}.
134 This is experimental and should become deprecated when it is replaced
135 with the Tk DND.
137 \item[\refmodule{turtle}]
138 Turtle graphics in a Tk window.
140 \end{description}
142 \subsection{Tkinter Life Preserver}
143 \sectionauthor{Matt Conway}{}
144 % Converted to LaTeX by Mike Clarkson.
146 This section is not designed to be an exhaustive tutorial on either
147 Tk or Tkinter. Rather, it is intended as a stop gap, providing some
148 introductory orientation on the system.
150 Credits:
151 \begin{itemize}
152 \item Tkinter was written by Steen Lumholt and Guido van Rossum.
153 \item Tk was written by John Ousterhout while at Berkeley.
154 \item This Life Preserver was written by Matt Conway at
155 the University of Virginia.
156 \item The html rendering, and some liberal editing, was
157 produced from a FrameMaker version by Ken Manheimer.
158 \item Fredrik Lundh elaborated and revised the class interface descriptions,
159 to get them current with Tk 4.2.
160 \item Mike Clarkson converted the documentation to \LaTeX, and compiled the
161 User Interface chapter of the reference manual.
162 \end{itemize}
165 \subsubsection{How To Use This Section}
167 This section is designed in two parts: the first half (roughly) covers
168 background material, while the second half can be taken to the
169 keyboard as a handy reference.
171 When trying to answer questions of the form ``how do I do blah'', it
172 is often best to find out how to do``blah'' in straight Tk, and then
173 convert this back into the corresponding \refmodule{Tkinter} call.
174 Python programmers can often guess at the correct Python command by
175 looking at the Tk documentation. This means that in order to use
176 Tkinter, you will have to know a little bit about Tk. This document
177 can't fulfill that role, so the best we can do is point you to the
178 best documentation that exists. Here are some hints:
180 \begin{itemize}
181 \item The authors strongly suggest getting a copy of the Tk man
182 pages. Specifically, the man pages in the \code{mann} directory are most
183 useful. The \code{man3} man pages describe the C interface to the Tk
184 library and thus are not especially helpful for script writers.
186 \item Addison-Wesley publishes a book called \citetitle{Tcl and the
187 Tk Toolkit} by John Ousterhout (ISBN 0-201-63337-X) which is a good
188 introduction to Tcl and Tk for the novice. The book is not
189 exhaustive, and for many details it defers to the man pages.
191 \item \file{Tkinter.py} is a last resort for most, but can be a good
192 place to go when nothing else makes sense.
193 \end{itemize}
195 \begin{seealso}
196 \seetitle[http://tcl.activestate.com/]
197 {ActiveState Tcl Home Page}
198 {The Tk/Tcl development is largely taking place at
199 ActiveState.}
200 \seetitle[http://www.amazon.com/exec/obidos/ASIN/020163337X]
201 {Tcl and the Tk Toolkit}
202 {The book by John Ousterhout, the inventor of Tcl .}
203 \seetitle[http://www.amazon.com/exec/obidos/ASIN/0130220280]
204 {Practical Programming in Tcl and Tk}
205 {Brent Welch's encyclopedic book.}
206 \end{seealso}
209 \subsubsection{A Simple Hello World Program} % HelloWorld.html
211 %begin{latexonly}
212 %\begin{figure}[hbtp]
213 %\centerline{\epsfig{file=HelloWorld.gif,width=.9\textwidth}}
214 %\vspace{.5cm}
215 %\caption{HelloWorld gadget image}
216 %\end{figure}
217 %See also the hello-world \ulink{notes}{classes/HelloWorld-notes.html} and
218 %\ulink{summary}{classes/HelloWorld-summary.html}.
219 %end{latexonly}
222 \begin{verbatim}
223 from Tkinter import *
225 class Application(Frame):
226 def say_hi(self):
227 print "hi there, everyone!"
229 def createWidgets(self):
230 self.QUIT = Button(self)
231 self.QUIT["text"] = "QUIT"
232 self.QUIT["fg"] = "red"
233 self.QUIT["command"] = self.quit
235 self.QUIT.pack({"side": "left"})
237 self.hi_there = Button(self)
238 self.hi_there["text"] = "Hello",
239 self.hi_there["command"] = self.say_hi
241 self.hi_there.pack({"side": "left"})
243 def __init__(self, master=None):
244 Frame.__init__(self, master)
245 self.pack()
246 self.createWidgets()
248 app = Application()
249 app.mainloop()
250 \end{verbatim}
253 \subsection{A (Very) Quick Look at Tcl/Tk} % BriefTclTk.html
255 The class hierarchy looks complicated, but in actual practice,
256 application programmers almost always refer to the classes at the very
257 bottom of the hierarchy.
259 Notes:
260 \begin{itemize}
261 \item These classes are provided for the purposes of
262 organizing certain functions under one namespace. They aren't meant to
263 be instantiated independently.
265 \item The \class{Tk} class is meant to be instantiated only once in
266 an application. Application programmers need not instantiate one
267 explicitly, the system creates one whenever any of the other classes
268 are instantiated.
270 \item The \class{Widget} class is not meant to be instantiated, it
271 is meant only for subclassing to make ``real'' widgets (in \Cpp, this
272 is called an `abstract class').
273 \end{itemize}
275 To make use of this reference material, there will be times when you
276 will need to know how to read short passages of Tk and how to identify
277 the various parts of a Tk command.
278 (See section~\ref{tkinter-basic-mapping} for the
279 \refmodule{Tkinter} equivalents of what's below.)
281 Tk scripts are Tcl programs. Like all Tcl programs, Tk scripts are
282 just lists of tokens separated by spaces. A Tk widget is just its
283 \emph{class}, the \emph{options} that help configure it, and the
284 \emph{actions} that make it do useful things.
286 To make a widget in Tk, the command is always of the form:
288 \begin{verbatim}
289 classCommand newPathname options
290 \end{verbatim}
292 \begin{description}
293 \item[\var{classCommand}]
294 denotes which kind of widget to make (a button, a label, a menu...)
296 \item[\var{newPathname}]
297 is the new name for this widget. All names in Tk must be unique. To
298 help enforce this, widgets in Tk are named with \emph{pathnames}, just
299 like files in a file system. The top level widget, the \emph{root},
300 is called \code{.} (period) and children are delimited by more
301 periods. For example, \code{.myApp.controlPanel.okButton} might be
302 the name of a widget.
304 \item[\var{options} ]
305 configure the widget's appearance and in some cases, its
306 behavior. The options come in the form of a list of flags and values.
307 Flags are proceeded by a `-', like unix shell command flags, and
308 values are put in quotes if they are more than one word.
309 \end{description}
311 For example:
313 \begin{verbatim}
314 button .fred -fg red -text "hi there"
315 ^ ^ \_____________________/
316 | | |
317 class new options
318 command widget (-opt val -opt val ...)
319 \end{verbatim}
321 Once created, the pathname to the widget becomes a new command. This
322 new \var{widget command} is the programmer's handle for getting the new
323 widget to perform some \var{action}. In C, you'd express this as
324 someAction(fred, someOptions), in \Cpp, you would express this as
325 fred.someAction(someOptions), and in Tk, you say:
327 \begin{verbatim}
328 .fred someAction someOptions
329 \end{verbatim}
331 Note that the object name, \code{.fred}, starts with a dot.
333 As you'd expect, the legal values for \var{someAction} will depend on
334 the widget's class: \code{.fred disable} works if fred is a
335 button (fred gets greyed out), but does not work if fred is a label
336 (disabling of labels is not supported in Tk).
338 The legal values of \var{someOptions} is action dependent. Some
339 actions, like \code{disable}, require no arguments, others, like
340 a text-entry box's \code{delete} command, would need arguments
341 to specify what range of text to delete.
344 \subsection{Mapping Basic Tk into Tkinter
345 \label{tkinter-basic-mapping}}
347 Class commands in Tk correspond to class constructors in Tkinter.
349 \begin{verbatim}
350 button .fred =====> fred = Button()
351 \end{verbatim}
353 The master of an object is implicit in the new name given to it at
354 creation time. In Tkinter, masters are specified explicitly.
356 \begin{verbatim}
357 button .panel.fred =====> fred = Button(panel)
358 \end{verbatim}
360 The configuration options in Tk are given in lists of hyphened tags
361 followed by values. In Tkinter, options are specified as
362 keyword-arguments in the instance constructor, and keyword-args for
363 configure calls or as instance indices, in dictionary style, for
364 established instances. See section~\ref{tkinter-setting-options} on
365 setting options.
367 \begin{verbatim}
368 button .fred -fg red =====> fred = Button(panel, fg = "red")
369 .fred configure -fg red =====> fred["fg"] = red
370 OR ==> fred.config(fg = "red")
371 \end{verbatim}
373 In Tk, to perform an action on a widget, use the widget name as a
374 command, and follow it with an action name, possibly with arguments
375 (options). In Tkinter, you call methods on the class instance to
376 invoke actions on the widget. The actions (methods) that a given
377 widget can perform are listed in the Tkinter.py module.
379 \begin{verbatim}
380 .fred invoke =====> fred.invoke()
381 \end{verbatim}
383 To give a widget to the packer (geometry manager), you call pack with
384 optional arguments. In Tkinter, the Pack class holds all this
385 functionality, and the various forms of the pack command are
386 implemented as methods. All widgets in \refmodule{Tkinter} are
387 subclassed from the Packer, and so inherit all the packing
388 methods. See the \refmodule{Tix} module documentation for additional
389 information on the Form geometry manager.
391 \begin{verbatim}
392 pack .fred -side left =====> fred.pack(side = "left")
393 \end{verbatim}
396 \subsection{How Tk and Tkinter are Related} % Relationship.html
398 \note{This was derived from a graphical image; the image will be used
399 more directly in a subsequent version of this document.}
401 From the top down:
402 \begin{description}
403 \item[\b{Your App Here (Python)}]
404 A Python application makes a \refmodule{Tkinter} call.
406 \item[\b{Tkinter (Python Module)}]
407 This call (say, for example, creating a button widget), is
408 implemented in the \emph{Tkinter} module, which is written in
409 Python. This Python function will parse the commands and the
410 arguments and convert them into a form that makes them look as if they
411 had come from a Tk script instead of a Python script.
413 \item[\b{tkinter (C)}]
414 These commands and their arguments will be passed to a C function
415 in the \emph{tkinter} - note the lowercase - extension module.
417 \item[\b{Tk Widgets} (C and Tcl)]
418 This C function is able to make calls into other C modules,
419 including the C functions that make up the Tk library. Tk is
420 implemented in C and some Tcl. The Tcl part of the Tk widgets is used
421 to bind certain default behaviors to widgets, and is executed once at
422 the point where the Python \refmodule{Tkinter} module is
423 imported. (The user never sees this stage).
425 \item[\b{Tk (C)}]
426 The Tk part of the Tk Widgets implement the final mapping to ...
428 \item[\b{Xlib (C)}]
429 the Xlib library to draw graphics on the screen.
430 \end{description}
433 \subsection{Handy Reference}
435 \subsubsection{Setting Options
436 \label{tkinter-setting-options}}
438 Options control things like the color and border width of a widget.
439 Options can be set in three ways:
441 \begin{description}
442 \item[At object creation time, using keyword arguments]:
443 \begin{verbatim}
444 fred = Button(self, fg = "red", bg = "blue")
445 \end{verbatim}
446 \item[After object creation, treating the option name like a dictionary index]:
447 \begin{verbatim}
448 fred["fg"] = "red"
449 fred["bg"] = "blue"
450 \end{verbatim}
451 \item[Use the config() method to update multiple attrs subesequent to
452 object creation]:
453 \begin{verbatim}
454 fred.config(fg = "red", bg = "blue")
455 \end{verbatim}
456 \end{description}
458 For a complete explanation of a given option and its behavior, see the
459 Tk man pages for the widget in question.
461 Note that the man pages list "STANDARD OPTIONS" and "WIDGET SPECIFIC
462 OPTIONS" for each widget. The former is a list of options that are
463 common to many widgets, the latter are the options that are
464 ideosyncratic to that particular widget. The Standard Options are
465 documented on the \manpage{options}{3} man page.
467 No distinction between standard and widget-specific options is made in
468 this document. Some options don't apply to some kinds of widgets.
469 Whether a given widget responds to a particular option depends on the
470 class of the widget; buttons have a \code{command} option, labels do not.
472 The options supported by a given widget are listed in that widget's
473 man page, or can be queried at runtime by calling the
474 \method{config()} method without arguments, or by calling the
475 \method{keys()} method on that widget. The return value of these
476 calls is a dictionary whose key is the name of the option as a string
477 (for example, \code{'relief'}) and whose values are 5-tuples.
479 Some options, like \code{bg} are synonyms for common options with long
480 names (\code{bg} is shorthand for "background"). Passing the
481 \code{config()} method the name of a shorthand option will return a
482 2-tuple, not 5-tuple. The 2-tuple passed back will contain the name of
483 the synonym and the ``real'' option (such as \code{('bg',
484 'background')}).
486 \begin{tableiii}{c|l|l}{textrm}{Index}{Meaning}{Example}
487 \lineiii{0}{option name} {\code{'relief'}}
488 \lineiii{1}{option name for database lookup} {\code{'relief'}}
489 \lineiii{2}{option class for database lookup} {\code{'Relief'}}
490 \lineiii{3}{default value} {\code{'raised'}}
491 \lineiii{4}{current value} {\code{'groove'}}
492 \end{tableiii}
495 Example:
497 \begin{verbatim}
498 >>> print fred.config()
499 {'relief' : ('relief', 'relief', 'Relief', 'raised', 'groove')}
500 \end{verbatim}
502 Of course, the dictionary printed will include all the options
503 available and their values. This is meant only as an example.
506 \subsubsection{The Packer} % Packer.html
507 \index{packing (widgets)}
509 The packer is one of Tk's geometry-management mechanisms. See also
510 \citetitle[classes/ClassPacker.html]{the Packer class interface}.
512 Geometry managers are used to specify the relative positioning of the
513 positioning of widgets within their container - their mutual
514 \emph{master}. In contrast to the more cumbersome \emph{placer}
515 (which is used less commonly, and we do not cover here), the packer
516 takes qualitative relationship specification - \emph{above}, \emph{to
517 the left of}, \emph{filling}, etc - and works everything out to
518 determine the exact placement coordinates for you.
520 The size of any \emph{master} widget is determined by the size of
521 the "slave widgets" inside. The packer is used to control where slave
522 widgets appear inside the master into which they are packed. You can
523 pack widgets into frames, and frames into other frames, in order to
524 achieve the kind of layout you desire. Additionally, the arrangement
525 is dynamically adjusted to accomodate incremental changes to the
526 configuration, once it is packed.
528 Note that widgets do not appear until they have had their geometry
529 specified with a geometry manager. It's a common early mistake to
530 leave out the geometry specification, and then be surprised when the
531 widget is created but nothing appears. A widget will appear only
532 after it has had, for example, the packer's \method{pack()} method
533 applied to it.
535 The pack() method can be called with keyword-option/value pairs that
536 control where the widget is to appear within its container, and how it
537 is to behave when the main application window is resized. Here are
538 some examples:
540 \begin{verbatim}
541 fred.pack() # defaults to side = "top"
542 fred.pack(side = "left")
543 fred.pack(expand = 1)
544 \end{verbatim}
547 \subsubsection{Packer Options}
549 For more extensive information on the packer and the options that it
550 can take, see the man pages and page 183 of John Ousterhout's book.
552 \begin{description}
553 \item[\b{anchor }]
554 Anchor type. Denotes where the packer is to place each slave in its
555 parcel.
557 \item[\b{expand}]
558 Boolean, \code{0} or \code{1}.
560 \item[\b{fill}]
561 Legal values: \code{'x'}, \code{'y'}, \code{'both'}, \code{'none'}.
563 \item[\b{ipadx} and \b{ipady}]
564 A distance - designating internal padding on each side of the slave
565 widget.
567 \item[\b{padx} and \b{pady}]
568 A distance - designating external padding on each side of the slave
569 widget.
571 \item[\b{side}]
572 Legal values are: \code{'left'}, \code{'right'}, \code{'top'},
573 \code{'bottom'}.
574 \end{description}
577 \subsubsection{Coupling Widget Variables} % VarCouplings.html
579 The current-value setting of some widgets (like text entry widgets)
580 can be connected directly to application variables by using special
581 options. These options are \code{variable}, \code{textvariable},
582 \code{onvalue}, \code{offvalue}, and \code{value}. This
583 connection works both ways: if the variable changes for any reason,
584 the widget it's connected to will be updated to reflect the new value.
586 Unfortunately, in the current implementation of \refmodule{Tkinter} it is
587 not possible to hand over an arbitrary Python variable to a widget
588 through a \code{variable} or \code{textvariable} option. The only
589 kinds of variables for which this works are variables that are
590 subclassed from a class called Variable, defined in the
591 \refmodule{Tkinter} module.
593 There are many useful subclasses of Variable already defined:
594 \class{StringVar}, \class{IntVar}, \class{DoubleVar}, and
595 \class{BooleanVar}. To read the current value of such a variable,
596 call the \method{get()} method on
597 it, and to change its value you call the \method{set()} method. If
598 you follow this protocol, the widget will always track the value of
599 the variable, with no further intervention on your part.
601 For example:
602 \begin{verbatim}
603 class App(Frame):
604 def __init__(self, master=None):
605 Frame.__init__(self, master)
606 self.pack()
608 self.entrythingy = Entry()
609 self.entrythingy.pack()
611 self.button.pack()
612 # here is the application variable
613 self.contents = StringVar()
614 # set it to some value
615 self.contents.set("this is a variable")
616 # tell the entry widget to watch this variable
617 self.entrythingy["textvariable"] = self.contents
619 # and here we get a callback when the user hits return.
620 # we will have the program print out the value of the
621 # application variable when the user hits return
622 self.entrythingy.bind('<Key-Return>',
623 self.print_contents)
625 def print_contents(self, event):
626 print "hi. contents of entry is now ---->", \
627 self.contents.get()
628 \end{verbatim}
631 \subsubsection{The Window Manager} % WindowMgr.html
632 \index{window manager (widgets)}
634 In Tk, there is a utility command, \code{wm}, for interacting with the
635 window manager. Options to the \code{wm} command allow you to control
636 things like titles, placement, icon bitmaps, and the like. In
637 \refmodule{Tkinter}, these commands have been implemented as methods
638 on the \class{Wm} class. Toplevel widgets are subclassed from the
639 \class{Wm} class, and so can call the \class{Wm} methods directly.
641 %See also \citetitle[classes/ClassWm.html]{the Wm class interface}.
643 To get at the toplevel window that contains a given widget, you can
644 often just refer to the widget's master. Of course if the widget has
645 been packed inside of a frame, the master won't represent a toplevel
646 window. To get at the toplevel window that contains an arbitrary
647 widget, you can call the \method{_root()} method. This
648 method begins with an underscore to denote the fact that this function
649 is part of the implementation, and not an interface to Tk functionality.
651 Here are some examples of typical usage:
653 \begin{verbatim}
654 import Tkinter
655 class App(Frame):
656 def __init__(self, master=None):
657 Frame.__init__(self, master)
658 self.pack()
661 # create the application
662 myapp = App()
665 # here are method calls to the window manager class
667 myapp.master.title("My Do-Nothing Application")
668 myapp.master.maxsize(1000, 400)
670 # start the program
671 myapp.mainloop()
672 \end{verbatim}
675 \subsubsection{Tk Option Data Types} % OptionTypes.html
677 \index{Tk Option Data Types}
679 \begin{description}
680 \item[anchor]
681 Legal values are points of the compass: \code{"n"},
682 \code{"ne"}, \code{"e"}, \code{"se"}, \code{"s"},
683 \code{"sw"}, \code{"w"}, \code{"nw"}, and also
684 \code{"center"}.
686 \item[bitmap]
687 There are eight built-in, named bitmaps: \code{'error'}, \code{'gray25'},
688 \code{'gray50'}, \code{'hourglass'}, \code{'info'}, \code{'questhead'},
689 \code{'question'}, \code{'warning'}. To specify an X bitmap
690 filename, give the full path to the file, preceded with an \code{@},
691 as in \code{"@/usr/contrib/bitmap/gumby.bit"}.
693 \item[boolean]
694 You can pass integers 0 or 1 or the strings \code{"yes"} or \code{"no"} .
696 \item[callback]
697 This is any Python function that takes no arguments. For example:
698 \begin{verbatim}
699 def print_it():
700 print "hi there"
701 fred["command"] = print_it
702 \end{verbatim}
704 \item[color]
705 Colors can be given as the names of X colors in the rgb.txt file,
706 or as strings representing RGB values in 4 bit: \code{"\#RGB"}, 8
707 bit: \code{"\#RRGGBB"}, 12 bit" \code{"\#RRRGGGBBB"}, or 16 bit
708 \code{"\#RRRRGGGGBBBB"} ranges, where R,G,B here represent any
709 legal hex digit. See page 160 of Ousterhout's book for details.
711 \item[cursor]
712 The standard X cursor names from \file{cursorfont.h} can be used,
713 without the \code{XC_} prefix. For example to get a hand cursor
714 (\constant{XC_hand2}), use the string \code{"hand2"}. You can also
715 specify a bitmap and mask file of your own. See page 179 of
716 Ousterhout's book.
718 \item[distance]
719 Screen distances can be specified in either pixels or absolute
720 distances. Pixels are given as numbers and absolute distances as
721 strings, with the trailing character denoting units: \code{c}
722 for centimeters, \code{i} for inches, \code{m} for millimeters,
723 \code{p} for printer's points. For example, 3.5 inches is expressed
724 as \code{"3.5i"}.
726 \item[font]
727 Tk uses a list font name format, such as \code{\{courier 10 bold\}}.
728 Font sizes with positive numbers are measured in points;
729 sizes with negative numbers are measured in pixels.
731 \item[geometry]
732 This is a string of the form \samp{\var{width}x\var{height}}, where
733 width and height are measured in pixels for most widgets (in
734 characters for widgets displaying text). For example:
735 \code{fred["geometry"] = "200x100"}.
737 \item[justify]
738 Legal values are the strings: \code{"left"},
739 \code{"center"}, \code{"right"}, and \code{"fill"}.
741 \item[region]
742 This is a string with four space-delimited elements, each of
743 which is a legal distance (see above). For example: \code{"2 3 4
744 5"} and \code{"3i 2i 4.5i 2i"} and \code{"3c 2c 4c 10.43c"}
745 are all legal regions.
747 \item[relief]
748 Determines what the border style of a widget will be. Legal
749 values are: \code{"raised"}, \code{"sunken"},
750 \code{"flat"}, \code{"groove"}, and \code{"ridge"}.
752 \item[scrollcommand]
753 This is almost always the \method{set()} method of some scrollbar
754 widget, but can be any widget method that takes a single argument.
755 Refer to the file \file{Demo/tkinter/matt/canvas-with-scrollbars.py}
756 in the Python source distribution for an example.
758 \item[wrap:]
759 Must be one of: \code{"none"}, \code{"char"}, or \code{"word"}.
760 \end{description}
763 \subsubsection{Bindings and Events} % Bindings.html
765 \index{bind (widgets)}
766 \index{events (widgets)}
768 The bind method from the widget command allows you to watch for
769 certain events and to have a callback function trigger when that event
770 type occurs. The form of the bind method is:
772 \begin{verbatim}
773 def bind(self, sequence, func, add=''):
774 \end{verbatim}
775 where:
777 \begin{description}
778 \item[sequence]
779 is a string that denotes the target kind of event. (See the bind
780 man page and page 201 of John Ousterhout's book for details).
782 \item[func]
783 is a Python function, taking one argument, to be invoked when the
784 event occurs. An Event instance will be passed as the argument.
785 (Functions deployed this way are commonly known as \var{callbacks}.)
787 \item[add]
788 is optional, either \samp{} or \samp{+}. Passing an empty string
789 denotes that this binding is to replace any other bindings that this
790 event is associated with. Preceeding with a \samp{+} means that this
791 function is to be added to the list of functions bound to this event type.
792 \end{description}
794 For example:
795 \begin{verbatim}
796 def turnRed(self, event):
797 event.widget["activeforeground"] = "red"
799 self.button.bind("<Enter>", self.turnRed)
800 \end{verbatim}
802 Notice how the widget field of the event is being accesed in the
803 \method{turnRed()} callback. This field contains the widget that
804 caught the X event. The following table lists the other event fields
805 you can access, and how they are denoted in Tk, which can be useful
806 when referring to the Tk man pages.
808 \begin{verbatim}
809 Tk Tkinter Event Field Tk Tkinter Event Field
810 -- ------------------- -- -------------------
811 %f focus %A char
812 %h height %E send_event
813 %k keycode %K keysym
814 %s state %N keysym_num
815 %t time %T type
816 %w width %W widget
817 %x x %X x_root
818 %y y %Y y_root
819 \end{verbatim}
822 \subsubsection{The index Parameter} % Index.html
824 A number of widgets require``index'' parameters to be passed. These
825 are used to point at a specific place in a Text widget, or to
826 particular characters in an Entry widget, or to particular menu items
827 in a Menu widget.
829 \begin{description}
830 \item[\b{Entry widget indexes (index, view index, etc.)}]
831 Entry widgets have options that refer to character positions in the
832 text being displayed. You can use these \refmodule{Tkinter} functions
833 to access these special points in text widgets:
835 \begin{description}
836 \item[AtEnd()]
837 refers to the last position in the text
839 \item[AtInsert()]
840 refers to the point where the text cursor is
842 \item[AtSelFirst()]
843 indicates the beginning point of the selected text
845 \item[AtSelLast()]
846 denotes the last point of the selected text and finally
848 \item[At(x\optional{, y})]
849 refers to the character at pixel location \var{x}, \var{y} (with
850 \var{y} not used in the case of a text entry widget, which contains a
851 single line of text).
852 \end{description}
854 \item[\b{Text widget indexes}]
855 The index notation for Text widgets is very rich and is best described
856 in the Tk man pages.
858 \item[\b{Menu indexes (menu.invoke(), menu.entryconfig(), etc.)}]
860 Some options and methods for menus manipulate specific menu entries.
861 Anytime a menu index is needed for an option or a parameter, you may
862 pass in:
863 \begin{itemize}
864 \item an integer which refers to the numeric position of the entry in
865 the widget, counted from the top, starting with 0;
866 \item the string \code{'active'}, which refers to the menu position that is
867 currently under the cursor;
868 \item the string \code{"last"} which refers to the last menu
869 item;
870 \item An integer preceded by \code{@}, as in \code{@6}, where the integer is
871 interpreted as a y pixel coordinate in the menu's coordinate system;
872 \item the string \code{"none"}, which indicates no menu entry at all, most
873 often used with menu.activate() to deactivate all entries, and
874 finally,
875 \item a text string that is pattern matched against the label of the
876 menu entry, as scanned from the top of the menu to the bottom. Note
877 that this index type is considered after all the others, which means
878 that matches for menu items labelled \code{last}, \code{active}, or
879 \code{none} may be interpreted as the above literals, instead.
880 \end{itemize}
881 \end{description}
883 \subsubsection{Images}
885 Bitmap/Pixelmap images can be created through the subclasses of
886 \class{Tkinter.Image}:
888 \begin{itemize}
889 \item \class{BitmapImage} can be used for X11 bitmap data.
890 \item \class{PhotoImage} can be used for GIF and PPM/PGM color bitmaps.
891 \end{itemize}
893 Either type of image is created through either the \code{file} or the
894 \code{data} option (other options are available as well).
896 The image object can then be used wherever an \code{image} option is
897 supported by some widget (e.g. labels, buttons, menus). In these
898 cases, Tk will not keep a reference to the image. When the last Python
899 reference to the image object is deleted, the image data is deleted as
900 well, and Tk will display an empty box wherever the image was used.
902 \section{\module{Tix} ---
903 Extension widgets for Tk}
905 \declaremodule{standard}{Tix}
906 \modulesynopsis{Tk Extension Widgets for Tkinter}
907 \sectionauthor{Mike Clarkson}{mikeclarkson@users.sourceforge.net}
909 \index{Tix}
911 The \module{Tix} (Tk Interface Extension) module provides an
912 additional rich set of widgets. Although the standard Tk library has
913 many useful widgets, they are far from complete. The \module{Tix}
914 library provides most of the commonly needed widgets that are missing
915 from standard Tk: \class{HList}, \class{ComboBox}, \class{Control}
916 (a.k.a. SpinBox) and an assortment of scrollable widgets. \module{Tix}
917 also includes many more widgets that are generally useful in a wide
918 range of applications: \class{NoteBook}, \class{FileEntry},
919 \class{PanedWindow}, etc; there are more than 40 of them.
921 With all these new widgets, you can introduce new interaction
922 techniques into applications, creating more useful and more intuitive
923 user interfaces. You can design your application by choosing the most
924 appropriate widgets to match the special needs of your application and
925 users.
927 \begin{seealso}
928 \seetitle[http://tix.sourceforge.net/]
929 {Tix Homepage}
930 {The home page for \module{Tix}. This includes links to
931 additional documentation and downloads.}
932 \seetitle[http://tix.sourceforge.net/dist/current/man/]
933 {Tix Man Pages}
934 {On-line version of the man pages and reference material.}
935 \seetitle[http://tix.sourceforge.net/dist/current/docs/tix-book/tix.book.html]
936 {Tix Programming Guide}
937 {On-line version of the programmer's reference material.}
938 \seetitle[http://tix.sourceforge.net/Tide/]
939 {Tix Development Applications}
940 {Tix applications for development of Tix and Tkinter programs.
941 Tide applications work under Tk or Tkinter, and include
942 \program{TixInspect}, an inspector to remotely modify and
943 debug Tix/Tk/Tkinter applications.}
944 \end{seealso}
947 \subsection{Using Tix}
949 \begin{classdesc}{Tix}{screenName\optional{, baseName\optional{, className}}}
950 Toplevel widget of Tix which represents mostly the main window
951 of an application. It has an associated Tcl interpreter.
953 Classes in the \refmodule{Tix} module subclasses the classes in the
954 \refmodule{Tkinter} module. The former imports the latter, so to use
955 \refmodule{Tix} with Tkinter, all you need to do is to import one
956 module. In general, you can just import \refmodule{Tix}, and replace
957 the toplevel call to \class{Tkinter.Tk} with \class{Tix.Tk}:
958 \begin{verbatim}
959 import Tix
960 from Tkconstants import *
961 root = Tix.Tk()
962 \end{verbatim}
963 \end{classdesc}
965 To use \refmodule{Tix}, you must have the \refmodule{Tix} widgets installed,
966 usually alongside your installation of the Tk widgets.
967 To test your installation, try the following:
968 \begin{verbatim}
969 import Tix
970 root = Tix.Tk()
971 root.tk.eval('package require Tix')
972 \end{verbatim}
974 If this fails, you have a Tk installation problem which must be
975 resolved before proceeding. Use the environment variable \envvar{TIX_LIBRARY}
976 to point to the installed \refmodule{Tix} library directory, and
977 make sure you have the dynamic object library (\file{tix8183.dll} or
978 \file{libtix8183.so}) in the same directory that contains your Tk
979 dynamic object library (\file{tk8183.dll} or \file{libtk8183.so}). The
980 directory with the dynamic object library should also have a file
981 called \file{pkgIndex.tcl} (case sensitive), which contains the line:
983 \begin{verbatim}
984 package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]
985 \end{verbatim} % $ <-- bow to font-lock
988 \subsection{Tix Widgets}
990 \ulink{Tix}
991 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm}
992 introduces over 40 widget classes to the \refmodule{Tkinter}
993 repertoire. There is a demo of all the \refmodule{Tix} widgets in the
994 \file{Demo/tix} directory of the standard distribution.
997 % The Python sample code is still being added to Python, hence commented out
1000 \subsubsection{Basic Widgets}
1002 \begin{classdesc}{Balloon}{}
1003 A \ulink{Balloon}
1004 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixBalloon.htm}
1005 that pops up over a widget to provide help. When the user moves the
1006 cursor inside a widget to which a Balloon widget has been bound, a
1007 small pop-up window with a descriptive message will be shown on the
1008 screen.
1009 \end{classdesc}
1011 % Python Demo of:
1012 % \ulink{Balloon}{http://tix.sourceforge.net/dist/current/demos/samples/Balloon.tcl}
1014 \begin{classdesc}{ButtonBox}{}
1015 The \ulink{ButtonBox}
1016 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixButtonBox.htm}
1017 widget creates a box of buttons, such as is commonly used for \code{Ok
1018 Cancel}.
1019 \end{classdesc}
1021 % Python Demo of:
1022 % \ulink{ButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/BtnBox.tcl}
1024 \begin{classdesc}{ComboBox}{}
1025 The \ulink{ComboBox}
1026 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixComboBox.htm}
1027 widget is similar to the combo box control in MS Windows. The user can
1028 select a choice by either typing in the entry subwdget or selecting
1029 from the listbox subwidget.
1030 \end{classdesc}
1032 % Python Demo of:
1033 % \ulink{ComboBox}{http://tix.sourceforge.net/dist/current/demos/samples/ComboBox.tcl}
1035 \begin{classdesc}{Control}{}
1036 The \ulink{Control}
1037 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixControl.htm}
1038 widget is also known as the \class{SpinBox} widget. The user can
1039 adjust the value by pressing the two arrow buttons or by entering the
1040 value directly into the entry. The new value will be checked against
1041 the user-defined upper and lower limits.
1042 \end{classdesc}
1044 % Python Demo of:
1045 % \ulink{Control}{http://tix.sourceforge.net/dist/current/demos/samples/Control.tcl}
1047 \begin{classdesc}{LabelEntry}{}
1048 The \ulink{LabelEntry}
1049 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelEntry.htm}
1050 widget packages an entry widget and a label into one mega widget. It
1051 can be used be used to simplify the creation of ``entry-form'' type of
1052 interface.
1053 \end{classdesc}
1055 % Python Demo of:
1056 % \ulink{LabelEntry}{http://tix.sourceforge.net/dist/current/demos/samples/LabEntry.tcl}
1058 \begin{classdesc}{LabelFrame}{}
1059 The \ulink{LabelFrame}
1060 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelFrame.htm}
1061 widget packages a frame widget and a label into one mega widget. To
1062 create widgets inside a LabelFrame widget, one creates the new widgets
1063 relative to the \member{frame} subwidget and manage them inside the
1064 \member{frame} subwidget.
1065 \end{classdesc}
1067 % Python Demo of:
1068 % \ulink{LabelFrame}{http://tix.sourceforge.net/dist/current/demos/samples/LabFrame.tcl}
1070 \begin{classdesc}{Meter}{}
1071 The \ulink{Meter}
1072 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixMeter.htm}
1073 widget can be used to show the progress of a background job which may
1074 take a long time to execute.
1075 \end{classdesc}
1077 % Python Demo of:
1078 % \ulink{Meter}{http://tix.sourceforge.net/dist/current/demos/samples/Meter.tcl}
1080 \begin{classdesc}{OptionMenu}{}
1081 The \ulink{OptionMenu}
1082 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixOptionMenu.htm}
1083 creates a menu button of options.
1084 \end{classdesc}
1086 % Python Demo of:
1087 % \ulink{OptionMenu}{http://tix.sourceforge.net/dist/current/demos/samples/OptMenu.tcl}
1089 \begin{classdesc}{PopupMenu}{}
1090 The \ulink{PopupMenu}
1091 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPopupMenu.htm}
1092 widget can be used as a replacement of the \code{tk_popup}
1093 command. The advantage of the \refmodule{Tix} \class{PopupMenu} widget
1094 is it requires less application code to manipulate.
1095 \end{classdesc}
1097 % Python Demo of:
1098 % \ulink{PopupMenu}{http://tix.sourceforge.net/dist/current/demos/samples/PopMenu.tcl}
1100 \begin{classdesc}{Select}{}
1101 The \ulink{Select}
1102 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixSelect.htm}
1103 widget is a container of button subwidgets. It can be used to provide
1104 radio-box or check-box style of selection options for the user.
1105 \end{classdesc}
1107 % Python Demo of:
1108 % \ulink{Select}{http://tix.sourceforge.net/dist/current/demos/samples/Select.tcl}
1110 \begin{classdesc}{StdButtonBox}{}
1111 The \ulink{StdButtonBox}
1112 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixStdButtonBox.htm}
1113 widget is a group of standard buttons for Motif-like dialog boxes.
1114 \end{classdesc}
1116 % Python Demo of:
1117 % \ulink{StdButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/StdBBox.tcl}
1120 \subsubsection{File Selectors}
1122 \begin{classdesc}{DirList}{}
1123 The \ulink{DirList}
1124 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirList.htm} widget
1125 displays a list view of a directory, its previous directories and its
1126 sub-directories. The user can choose one of the directories displayed
1127 in the list or change to another directory.
1128 \end{classdesc}
1130 % Python Demo of:
1131 % \ulink{DirList}{http://tix.sourceforge.net/dist/current/demos/samples/DirList.tcl}
1133 \begin{classdesc}{DirTree}{}
1134 The \ulink{DirTree}
1135 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirTree.htm}
1136 widget displays a tree view of a directory, its previous directories
1137 and its sub-directories. The user can choose one of the directories
1138 displayed in the list or change to another directory.
1139 \end{classdesc}
1141 % Python Demo of:
1142 % \ulink{DirTree}{http://tix.sourceforge.net/dist/current/demos/samples/DirTree.tcl}
1144 \begin{classdesc}{DirSelectDialog}{}
1145 The \ulink{DirSelectDialog}
1146 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirSelectDialog.htm}
1147 widget presents the directories in the file system in a dialog
1148 window. The user can use this dialog window to navigate through the
1149 file system to select the desired directory.
1150 \end{classdesc}
1152 % Python Demo of:
1153 % \ulink{DirSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/DirDlg.tcl}
1155 \begin{classdesc}{DirSelectBox}{}
1156 The \class{DirSelectBox} is similar
1157 to the standard Motif(TM) directory-selection box. It is generally used for
1158 the user to choose a directory. DirSelectBox stores the directories mostly
1159 recently selected into a ComboBox widget so that they can be quickly
1160 selected again.
1161 \end{classdesc}
1163 \begin{classdesc}{ExFileSelectBox}{}
1164 The \ulink{ExFileSelectBox}
1165 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm}
1166 widget is usually embedded in a tixExFileSelectDialog widget. It
1167 provides an convenient method for the user to select files. The style
1168 of the \class{ExFileSelectBox} widget is very similar to the standard
1169 file dialog on MS Windows 3.1.
1170 \end{classdesc}
1172 % Python Demo of:
1173 %\ulink{ExFileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/EFileDlg.tcl}
1175 \begin{classdesc}{FileSelectBox}{}
1176 The \ulink{FileSelectBox}
1177 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileSelectBox.htm}
1178 is similar to the standard Motif(TM) file-selection box. It is
1179 generally used for the user to choose a file. FileSelectBox stores the
1180 files mostly recently selected into a \class{ComboBox} widget so that
1181 they can be quickly selected again.
1182 \end{classdesc}
1184 % Python Demo of:
1185 % \ulink{FileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/FileDlg.tcl}
1187 \begin{classdesc}{FileEntry}{}
1188 The \ulink{FileEntry}
1189 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileEntry.htm}
1190 widget can be used to input a filename. The user can type in the
1191 filename manually. Alternatively, the user can press the button widget
1192 that sits next to the entry, which will bring up a file selection
1193 dialog.
1194 \end{classdesc}
1196 % Python Demo of:
1197 % \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl}
1200 \subsubsection{Hierachical ListBox}
1202 \begin{classdesc}{HList}{}
1203 The \ulink{HList}
1204 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixHList.htm}
1205 widget can be used to display any data that have a hierarchical
1206 structure, for example, file system directory trees. The list entries
1207 are indented and connected by branch lines according to their places
1208 in the hierachy.
1209 \end{classdesc}
1211 % Python Demo of:
1212 % \ulink{HList}{http://tix.sourceforge.net/dist/current/demos/samples/HList1.tcl}
1214 \begin{classdesc}{CheckList}{}
1215 The \ulink{CheckList}
1216 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixCheckList.htm}
1217 widget displays a list of items to be selected by the user. CheckList
1218 acts similarly to the Tk checkbutton or radiobutton widgets, except it
1219 is capable of handling many more items than checkbuttons or
1220 radiobuttons.
1221 \end{classdesc}
1223 % Python Demo of:
1224 % \ulink{ CheckList}{http://tix.sourceforge.net/dist/current/demos/samples/ChkList.tcl}
1225 % Python Demo of:
1226 % \ulink{ScrolledHList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList.tcl}
1227 % Python Demo of:
1228 % \ulink{ScrolledHList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList2.tcl}
1230 \begin{classdesc}{Tree}{}
1231 The \ulink{Tree}
1232 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTree.htm}
1233 widget can be used to display hierachical data in a tree form. The
1234 user can adjust the view of the tree by opening or closing parts of
1235 the tree.
1236 \end{classdesc}
1238 % Python Demo of:
1239 % \ulink{Tree}{http://tix.sourceforge.net/dist/current/demos/samples/Tree.tcl}
1241 % Python Demo of:
1242 % \ulink{Tree (Dynamic)}{http://tix.sourceforge.net/dist/current/demos/samples/DynTree.tcl}
1245 \subsubsection{Tabular ListBox}
1247 \begin{classdesc}{TList}{}
1248 The \ulink{TList}
1249 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTList.htm}
1250 widget can be used to display data in a tabular format. The list
1251 entries of a \class{TList} widget are similar to the entries in the Tk
1252 listbox widget. The main differences are (1) the \class{TList} widget
1253 can display the list entries in a two dimensional format and (2) you
1254 can use graphical images as well as multiple colors and fonts for the
1255 list entries.
1256 \end{classdesc}
1258 % Python Demo of:
1259 % \ulink{ScrolledTList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/STList1.tcl}
1260 % Python Demo of:
1261 % \ulink{ScrolledTList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/STList2.tcl}
1263 % Grid has yet to be added to Python
1264 % \subsubsection{Grid Widget}
1265 % Python Demo of:
1266 % \ulink{Simple Grid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid0.tcl}
1267 % Python Demo of:
1268 % \ulink{ScrolledGrid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid1.tcl}
1269 % Python Demo of:
1270 % \ulink{Editable Grid}{http://tix.sourceforge.net/dist/current/demos/samples/EditGrid.tcl}
1273 \subsubsection{Manager Widgets}
1275 \begin{classdesc}{PanedWindow}{}
1276 The \ulink{PanedWindow}
1277 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPanedWindow.htm}
1278 widget allows the user to interactively manipulate the sizes of
1279 several panes. The panes can be arranged either vertically or
1280 horizontally. The user changes the sizes of the panes by dragging the
1281 resize handle between two panes.
1282 \end{classdesc}
1284 % Python Demo of:
1285 % \ulink{PanedWindow}{http://tix.sourceforge.net/dist/current/demos/samples/PanedWin.tcl}
1287 \begin{classdesc}{ListNoteBook}{}
1288 The \ulink{ListNoteBook}
1289 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixListNoteBook.htm}
1290 widget is very similar to the \class{TixNoteBook} widget: it can be
1291 used to display many windows in a limited space using a notebook
1292 metaphor. The notebook is divided into a stack of pages (windows). At
1293 one time only one of these pages can be shown. The user can navigate
1294 through these pages by choosing the name of the desired page in the
1295 \member{hlist} subwidget.
1296 \end{classdesc}
1298 % Python Demo of:
1299 % \ulink{ListNoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/ListNBK.tcl}
1301 \begin{classdesc}{NoteBook}{}
1302 The \ulink{NoteBook}
1303 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixNoteBook.htm}
1304 widget can be used to display many windows in a limited space using a
1305 notebook metaphor. The notebook is divided into a stack of pages. At
1306 one time only one of these pages can be shown. The user can navigate
1307 through these pages by choosing the visual ``tabs'' at the top of the
1308 NoteBook widget.
1309 \end{classdesc}
1311 % Python Demo of:
1312 % \ulink{NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/NoteBook.tcl}
1315 % \subsubsection{Scrolled Widgets}
1316 % Python Demo of:
1317 % \ulink{ScrolledListBox}{http://tix.sourceforge.net/dist/current/demos/samples/SListBox.tcl}
1318 % Python Demo of:
1319 % \ulink{ScrolledText}{http://tix.sourceforge.net/dist/current/demos/samples/SText.tcl}
1320 % Python Demo of:
1321 % \ulink{ScrolledWindow}{http://tix.sourceforge.net/dist/current/demos/samples/SWindow.tcl}
1322 % Python Demo of:
1323 % \ulink{Canvas Object View}{http://tix.sourceforge.net/dist/current/demos/samples/CObjView.tcl}
1326 \subsubsection{Image Types}
1328 The \refmodule{Tix} module adds:
1329 \begin{itemize}
1330 \item
1331 \ulink{pixmap}
1332 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/pixmap.htm}
1333 capabilities to all \refmodule{Tix} and \refmodule{Tkinter} widgets to
1334 create color images from XPM files.
1336 % Python Demo of:
1337 % \ulink{XPM Image In Button}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm.tcl}
1339 % Python Demo of:
1340 % \ulink{XPM Image In Menu}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm1.tcl}
1342 \item
1343 \ulink{Compound}
1344 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/compound.html}
1345 image types can be used to create images that consists of multiple
1346 horizontal lines; each line is composed of a series of items (texts,
1347 bitmaps, images or spaces) arranged from left to right. For example, a
1348 compound image can be used to display a bitmap and a text string
1349 simutaneously in a Tk \class{Button} widget.
1351 % Python Demo of:
1352 % \ulink{Compound Image In Buttons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg.tcl}
1354 % Python Demo of:
1355 % \ulink{Compound Image In NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg2.tcl}
1357 % Python Demo of:
1358 % \ulink{Compound Image Notebook Color Tabs}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg4.tcl}
1360 % Python Demo of:
1361 % \ulink{Compound Image Icons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg3.tcl}
1362 \end{itemize}
1365 \subsubsection{Miscellaneous Widgets}
1367 \begin{classdesc}{InputOnly}{}
1368 The \ulink{InputOnly}
1369 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixInputOnly.htm}
1370 widgets are to accept inputs from the user, which can be done with the
1371 \code{bind} command (\UNIX{} only).
1372 \end{classdesc}
1374 \subsubsection{Form Geometry Manager}
1376 In addition, \refmodule{Tix} augments \refmodule{Tkinter} by providing:
1378 \begin{classdesc}{Form}{}
1379 The \ulink{Form}
1380 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm}
1381 geometry manager based on attachment rules for all Tk widgets.
1382 \end{classdesc}
1385 %begin{latexonly}
1386 %\subsection{Tix Class Structure}
1388 %\begin{figure}[hbtp]
1389 %\centerline{\epsfig{file=hierarchy.png,width=.9\textwidth}}
1390 %\vspace{.5cm}
1391 %\caption{The Class Hierarchy of Tix Widgets}
1392 %\end{figure}
1393 %end{latexonly}
1395 \subsection{Tix Commands}
1397 \begin{classdesc}{tixCommand}{}
1398 The \ulink{tix commands}
1399 {http://tix.sourceforge.net/dist/current/man/html/TixCmd/tix.htm}
1400 provide access to miscellaneous elements of \refmodule{Tix}'s internal
1401 state and the \refmodule{Tix} application context. Most of the information
1402 manipulated by these methods pertains to the application as a whole,
1403 or to a screen or display, rather than to a particular window.
1405 To view the current settings, the common usage is:
1406 \begin{verbatim}
1407 import Tix
1408 root = Tix.Tk()
1409 print root.tix_configure()
1410 \end{verbatim}
1411 \end{classdesc}
1413 \begin{methoddesc}{tix_configure}{\optional{cnf,} **kw}
1414 Query or modify the configuration options of the Tix application
1415 context. If no option is specified, returns a dictionary all of the
1416 available options. If option is specified with no value, then the
1417 method returns a list describing the one named option (this list will
1418 be identical to the corresponding sublist of the value returned if no
1419 option is specified). If one or more option-value pairs are
1420 specified, then the method modifies the given option(s) to have the
1421 given value(s); in this case the method returns an empty string.
1422 Option may be any of the configuration options.
1423 \end{methoddesc}
1425 \begin{methoddesc}{tix_cget}{option}
1426 Returns the current value of the configuration option given by
1427 \var{option}. Option may be any of the configuration options.
1428 \end{methoddesc}
1430 \begin{methoddesc}{tix_getbitmap}{name}
1431 Locates a bitmap file of the name \code{name.xpm} or \code{name} in
1432 one of the bitmap directories (see the \method{tix_addbitmapdir()}
1433 method). By using \method{tix_getbitmap()}, you can avoid hard
1434 coding the pathnames of the bitmap files in your application. When
1435 successful, it returns the complete pathname of the bitmap file,
1436 prefixed with the character \samp{@}. The returned value can be used to
1437 configure the \code{bitmap} option of the Tk and Tix widgets.
1438 \end{methoddesc}
1440 \begin{methoddesc}{tix_addbitmapdir}{directory}
1441 Tix maintains a list of directories under which the
1442 \method{tix_getimage()} and \method{tix_getbitmap()} methods will
1443 search for image files. The standard bitmap directory is
1444 \file{\$TIX_LIBRARY/bitmaps}. The \method{tix_addbitmapdir()} method
1445 adds \var{directory} into this list. By using this method, the image
1446 files of an applications can also be located using the
1447 \method{tix_getimage()} or \method{tix_getbitmap()} method.
1448 \end{methoddesc}
1450 \begin{methoddesc}{tix_filedialog}{\optional{dlgclass}}
1451 Returns the file selection dialog that may be shared among different
1452 calls from this application. This method will create a file selection
1453 dialog widget when it is called the first time. This dialog will be
1454 returned by all subsequent calls to \method{tix_filedialog()}. An
1455 optional dlgclass parameter can be passed as a string to specified
1456 what type of file selection dialog widget is desired. Possible
1457 options are \code{tix}, \code{FileSelectDialog} or
1458 \code{tixExFileSelectDialog}.
1459 \end{methoddesc}
1462 \begin{methoddesc}{tix_getimage}{self, name}
1463 Locates an image file of the name \file{name.xpm}, \file{name.xbm} or
1464 \file{name.ppm} in one of the bitmap directories (see the
1465 \method{tix_addbitmapdir()} method above). If more than one file with
1466 the same name (but different extensions) exist, then the image type is
1467 chosen according to the depth of the X display: xbm images are chosen
1468 on monochrome displays and color images are chosen on color
1469 displays. By using \method{tix_getimage()}, you can avoid hard coding
1470 the pathnames of the image files in your application. When successful,
1471 this method returns the name of the newly created image, which can be
1472 used to configure the \code{image} option of the Tk and Tix widgets.
1473 \end{methoddesc}
1475 \begin{methoddesc}{tix_option_get}{name}
1476 Gets the options manitained by the Tix scheme mechanism.
1477 \end{methoddesc}
1479 \begin{methoddesc}{tix_resetoptions}{newScheme, newFontSet\optional{,
1480 newScmPrio}}
1481 Resets the scheme and fontset of the Tix application to
1482 \var{newScheme} and \var{newFontSet}, respectively. This affects only
1483 those widgets created after this call. Therefore, it is best to call
1484 the resetoptions method before the creation of any widgets in a Tix
1485 application.
1487 The optional parameter \var{newScmPrio} can be given to reset the
1488 priority level of the Tk options set by the Tix schemes.
1490 Because of the way Tk handles the X option database, after Tix has
1491 been has imported and inited, it is not possible to reset the color
1492 schemes and font sets using the \method{tix_config()} method.
1493 Instead, the \method{tix_resetoptions()} method must be used.
1494 \end{methoddesc}
1498 \section{\module{ScrolledText} ---
1499 Scrolled Text Widget}
1501 \declaremodule{standard}{ScrolledText}
1502 \platform{Tk}
1503 \modulesynopsis{Text widget with a vertical scroll bar.}
1504 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
1506 The \module{ScrolledText} module provides a class of the same name
1507 which implements a basic text widget which has a vertical scroll bar
1508 configured to do the ``right thing.'' Using the \class{ScrolledText}
1509 class is a lot easier than setting up a text widget and scroll bar
1510 directly. The constructor is the same as that of the
1511 \class{Tkinter.Text} class.
1513 The text widget and scrollbar are packed together in a \class{Frame},
1514 and the methods of the \class{Grid} and \class{Pack} geometry managers
1515 are acquired from the \class{Frame} object. This allows the
1516 \class{ScrolledText} widget to be used directly to achieve most normal
1517 geometry management behavior.
1519 Should more specific control be necessary, the following attributes
1520 are available:
1522 \begin{memberdesc}[ScrolledText]{frame}
1523 The frame which surrounds the text and scroll bar widgets.
1524 \end{memberdesc}
1526 \begin{memberdesc}[ScrolledText]{vbar}
1527 The scroll bar widget.
1528 \end{memberdesc}
1531 \input{libturtle}
1534 \section{Idle \label{idle}}
1536 %\declaremodule{standard}{idle}
1537 %\modulesynopsis{A Python Integrated Developement Environment}
1538 \moduleauthor{Guido van Rossum}{guido@Python.org}
1540 Idle is the Python IDE built with the \refmodule{Tkinter} GUI toolkit.
1541 \index{Idle}
1542 \index{Python Editor}
1543 \index{Integrated Developement Environment}
1546 IDLE has the following features:
1548 \begin{itemize}
1549 \item coded in 100\% pure Python, using the \refmodule{Tkinter} GUI toolkit
1551 \item cross-platform: works on Windows and \UNIX{} (on Mac OS, there are
1552 currently problems with Tcl/Tk)
1554 \item multi-window text editor with multiple undo, Python colorizing
1555 and many other features, e.g. smart indent and call tips
1557 \item Python shell window (a.k.a. interactive interpreter)
1559 \item debugger (not complete, but you can set breakpoints, view and step)
1560 \end{itemize}
1563 \subsection{Menus}
1565 \subsubsection{File menu}
1567 \begin{description}
1568 \item[New window] create a new editing window
1569 \item[Open...] open an existing file
1570 \item[Open module...] open an existing module (searches sys.path)
1571 \item[Class browser] show classes and methods in current file
1572 \item[Path browser] show sys.path directories, modules, classes and methods
1573 \end{description}
1574 \index{Class browser}
1575 \index{Path browser}
1577 \begin{description}
1578 \item[Save] save current window to the associated file (unsaved
1579 windows have a * before and after the window title)
1581 \item[Save As...] save current window to new file, which becomes
1582 the associated file
1583 \item[Save Copy As...] save current window to different file
1584 without changing the associated file
1585 \end{description}
1587 \begin{description}
1588 \item[Close] close current window (asks to save if unsaved)
1589 \item[Exit] close all windows and quit IDLE (asks to save if unsaved)
1590 \end{description}
1593 \subsubsection{Edit menu}
1595 \begin{description}
1596 \item[Undo] Undo last change to current window (max 1000 changes)
1597 \item[Redo] Redo last undone change to current window
1598 \end{description}
1600 \begin{description}
1601 \item[Cut] Copy selection into system-wide clipboard; then delete selection
1602 \item[Copy] Copy selection into system-wide clipboard
1603 \item[Paste] Insert system-wide clipboard into window
1604 \item[Select All] Select the entire contents of the edit buffer
1605 \end{description}
1607 \begin{description}
1608 \item[Find...] Open a search dialog box with many options
1609 \item[Find again] Repeat last search
1610 \item[Find selection] Search for the string in the selection
1611 \item[Find in Files...] Open a search dialog box for searching files
1612 \item[Replace...] Open a search-and-replace dialog box
1613 \item[Go to line] Ask for a line number and show that line
1614 \end{description}
1616 \begin{description}
1617 \item[Indent region] Shift selected lines right 4 spaces
1618 \item[Dedent region] Shift selected lines left 4 spaces
1619 \item[Comment out region] Insert \#\# in front of selected lines
1620 \item[Uncomment region] Remove leading \# or \#\# from selected lines
1621 \item[Tabify region] Turns \emph{leading} stretches of spaces into tabs
1622 \item[Untabify region] Turn \emph{all} tabs into the right number of spaces
1623 \item[Expand word] Expand the word you have typed to match another
1624 word in the same buffer; repeat to get a different expansion
1625 \item[Format Paragraph] Reformat the current blank-line-separated paragraph
1626 \end{description}
1628 \begin{description}
1629 \item[Import module] Import or reload the current module
1630 \item[Run script] Execute the current file in the __main__ namespace
1631 \end{description}
1633 \index{Import module}
1634 \index{Run script}
1637 \subsubsection{Windows menu}
1639 \begin{description}
1640 \item[Zoom Height] toggles the window between normal size (24x80)
1641 and maximum height.
1642 \end{description}
1644 The rest of this menu lists the names of all open windows; select one
1645 to bring it to the foreground (deiconifying it if necessary).
1648 \subsubsection{Debug menu (in the Python Shell window only)}
1650 \begin{description}
1651 \item[Go to file/line] look around the insert point for a filename
1652 and linenumber, open the file, and show the line.
1653 \item[Open stack viewer] show the stack traceback of the last exception
1654 \item[Debugger toggle] Run commands in the shell under the debugger
1655 \item[JIT Stack viewer toggle] Open stack viewer on traceback
1656 \end{description}
1658 \index{stack viewer}
1659 \index{debugger}
1662 \subsection{Basic editing and navigation}
1664 \begin{itemize}
1665 \item \kbd{Backspace} deletes to the left; \kbd{Del} deletes to the right
1666 \item Arrow keys and \kbd{Page Up}/\kbd{Page Down} to move around
1667 \item \kbd{Home}/\kbd{End} go to begin/end of line
1668 \item \kbd{C-Home}/\kbd{C-End} go to begin/end of file
1669 \item Some \program{Emacs} bindings may also work, including \kbd{C-B},
1670 \kbd{C-P}, \kbd{C-A}, \kbd{C-E}, \kbd{C-D}, \kbd{C-L}
1671 \end{itemize}
1674 \subsubsection{Automatic indentation}
1676 After a block-opening statement, the next line is indented by 4 spaces
1677 (in the Python Shell window by one tab). After certain keywords
1678 (break, return etc.) the next line is dedented. In leading
1679 indentation, \kbd{Backspace} deletes up to 4 spaces if they are there.
1680 \kbd{Tab} inserts 1-4 spaces (in the Python Shell window one tab).
1681 See also the indent/dedent region commands in the edit menu.
1684 \subsubsection{Python Shell window}
1686 \begin{itemize}
1687 \item \kbd{C-C} interrupts executing command
1688 \item \kbd{C-D} sends end-of-file; closes window if typed at
1689 a \samp{>>>~} prompt
1690 \end{itemize}
1692 \begin{itemize}
1693 \item \kbd{Alt-p} retrieves previous command matching what you have typed
1694 \item \kbd{Alt-n} retrieves next
1695 \item \kbd{Return} while on any previous command retrieves that command
1696 \item \kbd{Alt-/} (Expand word) is also useful here
1697 \end{itemize}
1699 \index{indentation}
1702 \subsection{Syntax colors}
1704 The coloring is applied in a background ``thread,'' so you may
1705 occasionally see uncolorized text. To change the color
1706 scheme, edit the \code{[Colors]} section in \file{config.txt}.
1708 \begin{description}
1709 \item[Python syntax colors:]
1711 \begin{description}
1712 \item[Keywords] orange
1713 \item[Strings ] green
1714 \item[Comments] red
1715 \item[Definitions] blue
1716 \end{description}
1718 \item[Shell colors:]
1719 \begin{description}
1720 \item[Console output] brown
1721 \item[stdout] blue
1722 \item[stderr] dark green
1723 \item[stdin] black
1724 \end{description}
1725 \end{description}
1728 \subsubsection{Command line usage}
1730 \begin{verbatim}
1731 idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
1733 -c command run this command
1734 -d enable debugger
1735 -e edit mode; arguments are files to be edited
1736 -s run $IDLESTARTUP or $PYTHONSTARTUP first
1737 -t title set title of shell window
1738 \end{verbatim}
1740 If there are arguments:
1742 \begin{enumerate}
1743 \item If \programopt{-e} is used, arguments are files opened for
1744 editing and \code{sys.argv} reflects the arguments passed to
1745 IDLE itself.
1747 \item Otherwise, if \programopt{-c} is used, all arguments are
1748 placed in \code{sys.argv[1:...]}, with \code{sys.argv[0]} set
1749 to \code{'-c'}.
1751 \item Otherwise, if neither \programopt{-e} nor \programopt{-c} is
1752 used, the first argument is a script which is executed with
1753 the remaining arguments in \code{sys.argv[1:...]} and
1754 \code{sys.argv[0]} set to the script name. If the script name
1755 is '-', no script is executed but an interactive Python
1756 session is started; the arguments are still available in
1757 \code{sys.argv}.
1758 \end{enumerate}
1761 \section{Other Graphical User Interface Packages
1762 \label{other-gui-packages}}
1765 There are an number of extension widget sets to \refmodule{Tkinter}.
1767 \begin{seealso*}
1768 \seetitle[http://pmw.sourceforge.net/]{Python megawidgets}{is a
1769 toolkit for building high-level compound widgets in Python using the
1770 \refmodule{Tkinter} module. It consists of a set of base classes and
1771 a library of flexible and extensible megawidgets built on this
1772 foundation. These megawidgets include notebooks, comboboxes, selection
1773 widgets, paned widgets, scrolled widgets, dialog windows, etc. Also,
1774 with the Pmw.Blt interface to BLT, the busy, graph, stripchart, tabset
1775 and vector commands are be available.
1777 The initial ideas for Pmw were taken from the Tk \code{itcl}
1778 extensions \code{[incr Tk]} by Michael McLennan and \code{[incr
1779 Widgets]} by Mark Ulferts. Several of the megawidgets are direct
1780 translations from the itcl to Python. It offers most of the range of
1781 widgets that \code{[incr Widgets]} does, and is almost as complete as
1782 Tix, lacking however Tix's fast \class{HList} widget for drawing trees.
1785 \seetitle[http://tkinter.effbot.org/]{Tkinter3000 Widget Construction
1786 Kit (WCK)}{%
1787 is a library that allows you to write new Tkinter widgets in pure
1788 Python. The WCK framework gives you full control over widget
1789 creation, configuration, screen appearance, and event handling. WCK
1790 widgets can be very fast and light-weight, since they can operate
1791 directly on Python data structures, without having to transfer data
1792 through the Tk/Tcl layer.}
1793 \end{seealso*}
1796 Tk is not the only GUI for Python, but is however the
1797 most commonly used one.
1799 \begin{seealso*}
1800 \seetitle[http://www.wxwindows.org]{wxWindows}{
1801 is a GUI toolkit that combines the most attractive attributes of Qt,
1802 Tk, Motif, and GTK+ in one powerful and efficient package. It is
1803 implemented in \Cpp. wxWindows supports two flavors of \UNIX{}
1804 implementation: GTK+ and Motif, and under Windows, it has a standard
1805 Microsoft Foundation Classes (MFC) appearance, because it uses Win32
1806 widgets. There is a Python class wrapper, independent of Tkinter.
1808 wxWindows is much richer in widgets than \refmodule{Tkinter}, with its
1809 help system, sophisticated HTML and image viewers, and other
1810 specialized widgets, extensive documentation, and printing capabilities.
1812 \seetitle[]{PyQt}{
1813 PyQt is a \program{sip}-wrapped binding to the Qt toolkit. Qt is an
1814 extensive \Cpp{} GUI toolkit that is available for \UNIX, Windows and
1815 Mac OS X. \program{sip} is a tool for generating bindings for \Cpp{}
1816 libraries as Python classes, and is specifically designed for Python.
1817 An online manual is available at
1818 \url{http://www.opendocspublishing.com/pyqt/} (errata are located at
1819 \url{http://www.valdyas.org/python/book.html}).
1821 \seetitle[http://www.riverbankcomputing.co.uk/pykde/index.php]{PyKDE}{
1822 PyKDE is a \program{sip}-wrapped interface to the KDE desktop
1823 libraries. KDE is a desktop environment for \UNIX{} computers; the
1824 graphical components are based on Qt.
1826 \seetitle[http://fxpy.sourceforge.net/]{FXPy}{
1827 is a Python extension module which provides an interface to the
1828 \citetitle[http://www.cfdrc.com/FOX/fox.html]{FOX} GUI.
1829 FOX is a \Cpp{} based Toolkit for developing Graphical User Interfaces
1830 easily and effectively. It offers a wide, and growing, collection of
1831 Controls, and provides state of the art facilities such as drag and
1832 drop, selection, as well as OpenGL widgets for 3D graphical
1833 manipulation. FOX also implements icons, images, and user-convenience
1834 features such as status line help, and tooltips.
1836 Even though FOX offers a large collection of controls already, FOX
1837 leverages \Cpp{} to allow programmers to easily build additional Controls
1838 and GUI elements, simply by taking existing controls, and creating a
1839 derived class which simply adds or redefines the desired behavior.
1841 \seetitle[http://www.daa.com.au/\textasciitilde james/software/pygtk/]{PyGTK}{
1842 is a set of bindings for the \ulink{GTK}{http://www.gtk.org/} widget set.
1843 It provides an object oriented interface that is slightly higher
1844 level than the C one. It automatically does all the type casting and
1845 reference counting that you would have to do normally with the C
1846 API. There are also
1847 \ulink{bindings}{http://www.daa.com.au/\textasciitilde james/gnome/}
1848 to \ulink{GNOME}{http://www.gnome.org}, and a
1849 \ulink{tutorial}
1850 {http://laguna.fmedic.unam.mx/\textasciitilde daniel/pygtutorial/pygtutorial/index.html}
1851 is available.
1853 \end{seealso*}
1855 % XXX Reference URLs that compare the different UI packages