Commit 1a263ad6 authored by Ezio Melotti's avatar Ezio Melotti

#7057: fix several errors.

parent 580d60ce
...@@ -54,7 +54,7 @@ that will serve documentation to visiting Web browsers. :program:`pydoc` ...@@ -54,7 +54,7 @@ that will serve documentation to visiting Web browsers. :program:`pydoc`
:option:`-p 1234` will start a HTTP server on port 1234, allowing you to browse :option:`-p 1234` will start a HTTP server on port 1234, allowing you to browse
the documentation at ``http://localhost:1234/`` in your preferred Web browser. the documentation at ``http://localhost:1234/`` in your preferred Web browser.
:program:`pydoc` :option:`-g` will start the server and additionally bring up a :program:`pydoc` :option:`-g` will start the server and additionally bring up a
small :mod:`Tkinter`\ -based graphical interface to help you search for small :mod:`tkinter`\ -based graphical interface to help you search for
documentation pages. documentation pages.
When :program:`pydoc` generates documentation, it uses the current environment When :program:`pydoc` generates documentation, it uses the current environment
......
...@@ -30,8 +30,8 @@ is maintained at ActiveState.) ...@@ -30,8 +30,8 @@ is maintained at ActiveState.)
Tkinter Modules Tkinter Modules
--------------- ---------------
Most of the time, the :mod:`tkinter` is all you really need, but a number Most of the time, :mod:`tkinter` is all you really need, but a number of
of additional modules are available as well. The Tk interface is located in a additional modules are available as well. The Tk interface is located in a
binary module named :mod:`_tkinter`. This module contains the low-level binary module named :mod:`_tkinter`. This module contains the low-level
interface to Tk, and should never be used directly by application programmers. interface to Tk, and should never be used directly by application programmers.
It is usually a shared library (or DLL), but might in some cases be statically It is usually a shared library (or DLL), but might in some cases be statically
...@@ -112,13 +112,13 @@ orientation on the system. ...@@ -112,13 +112,13 @@ orientation on the system.
Credits: Credits:
* Tkinter was written by Steen Lumholt and Guido van Rossum.
* Tk was written by John Ousterhout while at Berkeley. * Tk was written by John Ousterhout while at Berkeley.
* Tkinter was written by Steen Lumholt and Guido van Rossum.
* This Life Preserver was written by Matt Conway at the University of Virginia. * This Life Preserver was written by Matt Conway at the University of Virginia.
* The html rendering, and some liberal editing, was produced from a FrameMaker * The HTML rendering, and some liberal editing, was produced from a FrameMaker
version by Ken Manheimer. version by Ken Manheimer.
* Fredrik Lundh elaborated and revised the class interface descriptions, to get * Fredrik Lundh elaborated and revised the class interface descriptions, to get
...@@ -143,10 +143,10 @@ order to use Tkinter, you will have to know a little bit about Tk. This document ...@@ -143,10 +143,10 @@ order to use Tkinter, you will have to know a little bit about Tk. This document
can't fulfill that role, so the best we can do is point you to the best can't fulfill that role, so the best we can do is point you to the best
documentation that exists. Here are some hints: documentation that exists. Here are some hints:
* The authors strongly suggest getting a copy of the Tk man pages. Specifically, * The authors strongly suggest getting a copy of the Tk man pages.
the man pages in the ``mann`` directory are most useful. The ``man3`` man pages Specifically, the man pages in the ``manN`` directory are most useful.
describe the C interface to the Tk library and thus are not especially helpful The ``man3`` man pages describe the C interface to the Tk library and thus
for script writers. are not especially helpful for script writers.
* Addison-Wesley publishes a book called Tcl and the Tk Toolkit by John * Addison-Wesley publishes a book called Tcl and the Tk Toolkit by John
Ousterhout (ISBN 0-201-63337-X) which is a good introduction to Tcl and Tk for Ousterhout (ISBN 0-201-63337-X) which is a good introduction to Tcl and Tk for
...@@ -159,6 +159,9 @@ documentation that exists. Here are some hints: ...@@ -159,6 +159,9 @@ documentation that exists. Here are some hints:
.. seealso:: .. seealso::
`Tcl/Tk 8.6 man pages <http://www.tcl.tk/man/tcl8.6/>`_
The Tcl/Tk manual on www.tcl.tk.
`ActiveState Tcl Home Page <http://tcl.activestate.com/>`_ `ActiveState Tcl Home Page <http://tcl.activestate.com/>`_
The Tk/Tcl development is largely taking place at ActiveState. The Tk/Tcl development is largely taking place at ActiveState.
...@@ -257,7 +260,7 @@ To make a widget in Tk, the command is always of the form:: ...@@ -257,7 +260,7 @@ To make a widget in Tk, the command is always of the form::
For example:: For example::
button .fred -fg red -text "hi there" button .fred -fg red -text "hi there"
^ ^ \_____________________/ ^ ^ \______________________/
| | | | | |
class new options class new options
command widget (-opt val -opt val ...) command widget (-opt val -opt val ...)
...@@ -301,15 +304,15 @@ constructor, and keyword-args for configure calls or as instance indices, in ...@@ -301,15 +304,15 @@ constructor, and keyword-args for configure calls or as instance indices, in
dictionary style, for established instances. See section dictionary style, for established instances. See section
:ref:`tkinter-setting-options` on setting options. :: :ref:`tkinter-setting-options` on setting options. ::
button .fred -fg red =====> fred = Button(panel, fg = "red") button .fred -fg red =====> fred = Button(panel, fg="red")
.fred configure -fg red =====> fred["fg"] = red .fred configure -fg red =====> fred["fg"] = red
OR ==> fred.config(fg = "red") OR ==> fred.config(fg="red")
In Tk, to perform an action on a widget, use the widget name as a command, and In Tk, to perform an action on a widget, use the widget name as a command, and
follow it with an action name, possibly with arguments (options). In Tkinter, follow it with an action name, possibly with arguments (options). In Tkinter,
you call methods on the class instance to invoke actions on the widget. The you call methods on the class instance to invoke actions on the widget. The
actions (methods) that a given widget can perform are listed in the Tkinter.py actions (methods) that a given widget can perform are listed in
module. :: :file:`tkinter/__init__.py`. ::
.fred invoke =====> fred.invoke() .fred invoke =====> fred.invoke()
...@@ -320,7 +323,7 @@ various forms of the pack command are implemented as methods. All widgets in ...@@ -320,7 +323,7 @@ various forms of the pack command are implemented as methods. All widgets in
methods. See the :mod:`tkinter.tix` module documentation for additional methods. See the :mod:`tkinter.tix` module documentation for additional
information on the Form geometry manager. :: information on the Form geometry manager. ::
pack .fred -side left =====> fred.pack(side = "left") pack .fred -side left =====> fred.pack(side="left")
How Tk and Tkinter are Related How Tk and Tkinter are Related
...@@ -332,14 +335,15 @@ Your App Here (Python) ...@@ -332,14 +335,15 @@ Your App Here (Python)
A Python application makes a :mod:`tkinter` call. A Python application makes a :mod:`tkinter` call.
tkinter (Python Package) tkinter (Python Package)
This call (say, for example, creating a button widget), is implemented in the This call (say, for example, creating a button widget), is implemented in
*tkinter* package, which is written in Python. This Python function will parse the :mod:`tkinter` package, which is written in Python. This Python
the commands and the arguments and convert them into a form that makes them look function will parse the commands and the arguments and convert them into a
as if they had come from a Tk script instead of a Python script. form that makes them look as if they had come from a Tk script instead of
a Python script.
tkinter (C) _tkinter (C)
These commands and their arguments will be passed to a C function in the These commands and their arguments will be passed to a C function in the
*tkinter* - note the lowercase - extension module. :mod:`_tkinter` - note the underscore - extension module.
Tk Widgets (C and Tcl) Tk Widgets (C and Tcl)
This C function is able to make calls into other C modules, including the C This C function is able to make calls into other C modules, including the C
...@@ -370,7 +374,7 @@ be set in three ways: ...@@ -370,7 +374,7 @@ be set in three ways:
At object creation time, using keyword arguments At object creation time, using keyword arguments
:: ::
fred = Button(self, fg = "red", bg = "blue") fred = Button(self, fg="red", bg="blue")
After object creation, treating the option name like a dictionary index After object creation, treating the option name like a dictionary index
:: ::
...@@ -381,7 +385,7 @@ After object creation, treating the option name like a dictionary index ...@@ -381,7 +385,7 @@ After object creation, treating the option name like a dictionary index
Use the config() method to update multiple attrs subsequent to object creation Use the config() method to update multiple attrs subsequent to object creation
:: ::
fred.config(fg = "red", bg = "blue") fred.config(fg="red", bg="blue")
For a complete explanation of a given option and its behavior, see the Tk man For a complete explanation of a given option and its behavior, see the Tk man
pages for the widget in question. pages for the widget in question.
...@@ -464,8 +468,8 @@ where the widget is to appear within its container, and how it is to behave when ...@@ -464,8 +468,8 @@ where the widget is to appear within its container, and how it is to behave when
the main application window is resized. Here are some examples:: the main application window is resized. Here are some examples::
fred.pack() # defaults to side = "top" fred.pack() # defaults to side = "top"
fred.pack(side = "left") fred.pack(side="left")
fred.pack(expand = 1) fred.pack(expand=1)
Packer Options Packer Options
...@@ -506,7 +510,7 @@ Unfortunately, in the current implementation of :mod:`tkinter` it is not ...@@ -506,7 +510,7 @@ Unfortunately, in the current implementation of :mod:`tkinter` it is not
possible to hand over an arbitrary Python variable to a widget through a possible to hand over an arbitrary Python variable to a widget through a
``variable`` or ``textvariable`` option. The only kinds of variables for which ``variable`` or ``textvariable`` option. The only kinds of variables for which
this works are variables that are subclassed from a class called Variable, this works are variables that are subclassed from a class called Variable,
defined in the :mod:`tkinter`. defined in :mod:`tkinter`.
There are many useful subclasses of Variable already defined: There are many useful subclasses of Variable already defined:
:class:`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and :class:`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and
...@@ -702,24 +706,32 @@ Notice how the widget field of the event is being accessed in the ...@@ -702,24 +706,32 @@ Notice how the widget field of the event is being accessed in the
:meth:`turnRed` callback. This field contains the widget that caught the X :meth:`turnRed` callback. This field contains the widget that caught the X
event. The following table lists the other event fields you can access, and how event. The following table lists the other event fields you can access, and how
they are denoted in Tk, which can be useful when referring to the Tk man pages. they are denoted in Tk, which can be useful when referring to the Tk man pages.
::
Tk Tkinter Event Field Tk Tkinter Event Field +----+---------------------+----+---------------------+
-- ------------------- -- ------------------- | Tk | Tkinter Event Field | Tk | Tkinter Event Field |
%f focus %A char +====+=====================+====+=====================+
%h height %E send_event | %f | focus | %A | char |
%k keycode %K keysym +----+---------------------+----+---------------------+
%s state %N keysym_num | %h | height | %E | send_event |
%t time %T type +----+---------------------+----+---------------------+
%w width %W widget | %k | keycode | %K | keysym |
%x x %X x_root +----+---------------------+----+---------------------+
%y y %Y y_root | %s | state | %N | keysym_num |
+----+---------------------+----+---------------------+
| %t | time | %T | type |
+----+---------------------+----+---------------------+
| %w | width | %W | widget |
+----+---------------------+----+---------------------+
| %x | x | %X | x_root |
+----+---------------------+----+---------------------+
| %y | y | %Y | y_root |
+----+---------------------+----+---------------------+
The index Parameter The index Parameter
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
A number of widgets require"index" parameters to be passed. These are used to A number of widgets require "index" parameters to be passed. These are used to
point at a specific place in a Text widget, or to particular characters in an point at a specific place in a Text widget, or to particular characters in an
Entry widget, or to particular menu items in a Menu widget. Entry widget, or to particular menu items in a Menu widget.
...@@ -755,7 +767,7 @@ Menu indexes (menu.invoke(), menu.entryconfig(), etc.) ...@@ -755,7 +767,7 @@ Menu indexes (menu.invoke(), menu.entryconfig(), etc.)
* an integer which refers to the numeric position of the entry in the widget, * an integer which refers to the numeric position of the entry in the widget,
counted from the top, starting with 0; counted from the top, starting with 0;
* the string ``'active'``, which refers to the menu position that is currently * the string ``"active"``, which refers to the menu position that is currently
under the cursor; under the cursor;
* the string ``"last"`` which refers to the last menu item; * the string ``"last"`` which refers to the last menu item;
......
...@@ -84,7 +84,7 @@ Tix Widgets ...@@ -84,7 +84,7 @@ Tix Widgets
----------- -----------
`Tix <http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm>`_ `Tix <http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm>`_
introduces over 40 widget classes to the :mod:`Tkinter` repertoire. There is a introduces over 40 widget classes to the :mod:`tkinter` repertoire. There is a
demo of all the :mod:`tkinter.tix` widgets in the :file:`Demo/tix` directory of demo of all the :mod:`tkinter.tix` widgets in the :file:`Demo/tix` directory of
the standard distribution. the standard distribution.
......
...@@ -116,12 +116,13 @@ All the :mod:`ttk` Widgets accepts the following options: ...@@ -116,12 +116,13 @@ All the :mod:`ttk` Widgets accepts the following options:
| | for the parent widget. | | | for the parent widget. |
+-----------+--------------------------------------------------------------+ +-----------+--------------------------------------------------------------+
| takefocus | Determines whether the window accepts the focus during | | takefocus | Determines whether the window accepts the focus during |
| | keyboard traversal. 0, 1 or an empty is return. If 0 is | | | keyboard traversal. 0, 1 or an empty string is returned. |
| | returned, it means that the window should be skipped entirely| | | If 0 is returned, it means that the window should be skipped |
| | during keyboard traversal. If 1, it means that the window | | | entirely during keyboard traversal. If 1, it means that the |
| | should receive the input focus as long as it is viewable. And| | | window should receive the input focus as long as it is |
| | an empty string means that the traversal scripts make the | | | viewable. And an empty string means that the traversal |
| | decision about whether or not to focus on the window. | | | scripts make the decision about whether or not to focus |
| | on the window. |
+-----------+--------------------------------------------------------------+ +-----------+--------------------------------------------------------------+
| style | May be used to specify a custom widget style. | | style | May be used to specify a custom widget style. |
+-----------+--------------------------------------------------------------+ +-----------+--------------------------------------------------------------+
......
...@@ -35,13 +35,13 @@ programmer to use all the commands, classes and methods interactively when using ...@@ -35,13 +35,13 @@ programmer to use all the commands, classes and methods interactively when using
the module from within IDLE run with the ``-n`` switch. the module from within IDLE run with the ``-n`` switch.
The turtle module provides turtle graphics primitives, in both object-oriented The turtle module provides turtle graphics primitives, in both object-oriented
and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying and procedure-oriented ways. Because it uses :mod:`tkinter` for the underlying
graphics, it needs a version of Python installed with Tk support. graphics, it needs a version of Python installed with Tk support.
The object-oriented interface uses essentially two+two classes: The object-oriented interface uses essentially two+two classes:
1. The :class:`TurtleScreen` class defines graphics windows as a playground for 1. The :class:`TurtleScreen` class defines graphics windows as a playground for
the drawing turtles. Its constructor needs a :class:`Tkinter.Canvas` or a the drawing turtles. Its constructor needs a :class:`tkinter.Canvas` or a
:class:`ScrolledCanvas` as argument. It should be used when :mod:`turtle` is :class:`ScrolledCanvas` as argument. It should be used when :mod:`turtle` is
used as part of some application. used as part of some application.
...@@ -1998,7 +1998,7 @@ The public classes of the module :mod:`turtle` ...@@ -1998,7 +1998,7 @@ The public classes of the module :mod:`turtle`
.. class:: RawTurtle(canvas) .. class:: RawTurtle(canvas)
RawPen(canvas) RawPen(canvas)
:param canvas: a :class:`Tkinter.Canvas`, a :class:`ScrolledCanvas` or a :param canvas: a :class:`tkinter.Canvas`, a :class:`ScrolledCanvas` or a
:class:`TurtleScreen` :class:`TurtleScreen`
Create a turtle. The turtle has all methods described above as "methods of Create a turtle. The turtle has all methods described above as "methods of
...@@ -2013,7 +2013,7 @@ The public classes of the module :mod:`turtle` ...@@ -2013,7 +2013,7 @@ The public classes of the module :mod:`turtle`
.. class:: TurtleScreen(cv) .. class:: TurtleScreen(cv)
:param cv: a :class:`Tkinter.Canvas` :param cv: a :class:`tkinter.Canvas`
Provides screen oriented methods like :func:`setbg` etc. that are described Provides screen oriented methods like :func:`setbg` etc. that are described
above. above.
......
...@@ -143,7 +143,7 @@ There are several options for building GUI applications on the Mac with Python. ...@@ -143,7 +143,7 @@ There are several options for building GUI applications on the Mac with Python.
the foundation of most modern Mac development. Information on PyObjC is the foundation of most modern Mac development. Information on PyObjC is
available from http://pyobjc.sourceforge.net. available from http://pyobjc.sourceforge.net.
The standard Python GUI toolkit is :mod:`Tkinter`, based on the cross-platform The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-platform
Tk toolkit (http://www.tcl.tk). An Aqua-native version of Tk is bundled with OS Tk toolkit (http://www.tcl.tk). An Aqua-native version of Tk is bundled with OS
X by Apple, and the latest version can be downloaded and installed from X by Apple, and the latest version can be downloaded and installed from
http://www.activestate.com; it can also be built from source. http://www.activestate.com; it can also be built from source.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment