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