rest25/library/tkinter.rst => rest262/library/tkinter.rst
n1- 
2-.. _tkinter:
3- 
4-*********************************
5-Graphical User Interfaces with Tk
6-*********************************
7- 
8-.. index::
9-   single: GUI
10-   single: Graphical User Interface
11-   single: Tkinter
12-   single: Tk
13- 
14-Tk/Tcl has long been an integral part of Python.  It provides a robust and
15-platform independent windowing toolkit, that is available to Python programmers
16-using the :mod:`Tkinter` module, and its extension, the :mod:`Tix` module.
17- 
18-The :mod:`Tkinter` module is a thin object-oriented layer on top of Tcl/Tk. To
19-use :mod:`Tkinter`, you don't need to write Tcl code, but you will need to
20-consult the Tk documentation, and occasionally the Tcl documentation.
21-:mod:`Tkinter` is a set of wrappers that implement the Tk widgets as Python
22-classes.  In addition, the internal module :mod:`_tkinter` provides a threadsafe
23-mechanism which allows Python and Tcl to interact.
24- 
25-Tk is not the only GUI for Python; see section :ref:`other-gui-packages`, "Other
26-User Interface Modules and Packages," for more information on other GUI toolkits
27-for Python.
28- 
29-.. % Other sections I have in mind are
30-.. % Tkinter internals
31-.. % Freezing Tkinter applications
32- 
33- 
34-.. toctree::
35- 
36- 
37:mod:`Tkinter` --- Python interface to Tcl/Tk
38=============================================
39
40.. module:: Tkinter
41   :synopsis: Interface to Tcl/Tk for graphical user interfaces
42.. moduleauthor:: Guido van Rossum <guido@Python.org>
43
44
45The :mod:`Tkinter` module ("Tk interface") is the standard Python interface to
46the Tk GUI toolkit.  Both Tk and :mod:`Tkinter` are available on most Unix
n47-platforms, as well as on Windows and Macintosh systems.  (Tk itself is not part
n11+platforms, as well as on Windows systems.  (Tk itself is not part of Python; it
48-of Python; it is maintained at ActiveState.)
12+is maintained at ActiveState.)
49
n14+.. note::
15+ 
16+   :mod:`Tkinter` has been renamed to :mod:`tkinter` in Python 3.0.  The
17+   :term:`2to3` tool will automatically adapt imports when converting your
18+   sources to 3.0.
50
51.. seealso::
52
53   `Python Tkinter Resources <http://www.python.org/topics/tkinter/>`_
54      The Python Tkinter Topic Guide provides a great deal of information on using Tk
55      from Python and links to other sources of information on Tk.
56
57   `An Introduction to Tkinter <http://www.pythonware.com/library/an-introduction-to-tkinter.htm>`_
58      Fredrik Lundh's on-line reference material.
59
n60-   `Tkinter reference: a GUI for Python <http://www.nmt.edu/tcc/help/pubs/lang.html>`_
n29+   `Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_
61      On-line reference material.
62
63   `Tkinter for JPython <http://jtkinter.sourceforge.net>`_
64      The Jython interface to Tkinter.
65
66   `Python and Tkinter Programming <http://www.amazon.com/exec/obidos/ASIN/1884777813>`_
67      The book by John Grayson (ISBN 1-884777-81-3).
68
90
91
92.. class:: Tk(screenName=None, baseName=None, className='Tk', useTk=1)
93
94   The :class:`Tk` class is instantiated without arguments. This creates a toplevel
95   widget of Tk which usually is the main window of an application. Each instance
96   has its own associated Tcl interpreter.
97
n98-   .. % FIXME: The following keyword arguments are currently recognized:
n67+   .. FIXME: The following keyword arguments are currently recognized:
99
100   .. versionchanged:: 2.4
101      The *useTk* parameter was added.
102
103
104.. function:: Tcl(screenName=None, baseName=None, className='Tk', useTk=0)
105
106   The :func:`Tcl` function is a factory function which creates an object much like
138
139:mod:`Tkdnd`
140   Drag-and-drop support for :mod:`Tkinter`. This is experimental and should become
141   deprecated when it is replaced  with the Tk DND.
142
143:mod:`turtle`
144   Turtle graphics in a Tk window.
145
n115+These have been renamed as well in Python 3.0; they were all made submodules of
116+the new ``tkinter`` package.
117+ 
146
147Tkinter Life Preserver
148----------------------
149
150.. sectionauthor:: Matt Conway
151
152
153This section is not designed to be an exhaustive tutorial on either Tk or
154Tkinter.  Rather, it is intended as a stop gap, providing some introductory
155orientation on the system.
n156- 
157-.. % Converted to LaTeX by Mike Clarkson.
158
159Credits:
160
161* Tkinter was written by Steen Lumholt and Guido van Rossum.
162
163* Tk was written by John Ousterhout while at Berkeley.
164
165* This Life Preserver was written by Matt Conway at the University of Virginia.
213
214   `Practical Programming in Tcl and Tk <http://www.amazon.com/exec/obidos/ASIN/0130220280>`_
215      Brent Welch's encyclopedic book.
216
217
218A Simple Hello World Program
219^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220
n221-.. % HelloWorld.html
222-.. % begin{latexonly}
223-.. % \begin{figure}[hbtp]
224-.. % \centerline{\epsfig{file=HelloWorld.gif,width=.9\textwidth}}
225-.. % \vspace{.5cm}
226-.. % \caption{HelloWorld gadget image}
227-.. % \end{figure}
228-.. % See also the hello-world \ulink{notes}{classes/HelloWorld-notes.html} and
229-.. % \ulink{summary}{classes/HelloWorld-summary.html}.
230-.. % end{latexonly}
231- 
232::
233
234   from Tkinter import *
235
236   class Application(Frame):
237       def say_hi(self):
238           print "hi there, everyone!"
239
263
264
265A (Very) Quick Look at Tcl/Tk
266-----------------------------
267
268The class hierarchy looks complicated, but in actual practice, application
269programmers almost always refer to the classes at the very bottom of the
270hierarchy.
n271- 
272-.. % BriefTclTk.html
273
274Notes:
275
276* These classes are provided for the purposes of organizing certain functions
277  under one namespace. They aren't meant to be instantiated independently.
278
279* The :class:`Tk` class is meant to be instantiated only once in an application.
280  Application programmers need not instantiate one explicitly, the system creates
304   is the new name for this widget.  All names in Tk must be unique.  To help
305   enforce this, widgets in Tk are named with *pathnames*, just like files in a
306   file system.  The top level widget, the *root*, is called ``.`` (period) and
307   children are delimited by more periods.  For example,
308   ``.myApp.controlPanel.okButton`` might be the name of a widget.
309
310*options*
311   configure the widget's appearance and in some cases, its behavior.  The options
n312-   come in the form of a list of flags and values. Flags are proceeded by a '-',
n269+   come in the form of a list of flags and values. Flags are preceded by a '-',
313   like Unix shell command flags, and values are put in quotes if they are more
314   than one word.
315
316For example::
317
318   button   .fred   -fg red -text "hi there"
319      ^       ^     \_____________________/
320      |       |                |
322   command  widget  (-opt val -opt val ...)
323
324Once created, the pathname to the widget becomes a new command.  This new
325*widget command* is the programmer's handle for getting the new widget to
326perform some *action*.  In C, you'd express this as someAction(fred,
327someOptions), in C++, you would express this as fred.someAction(someOptions),
328and in Tk, you say::
329
n330-   .fred someAction someOptions 
n287+   .fred someAction someOptions
331
332Note that the object name, ``.fred``, starts with a dot.
333
334As you'd expect, the legal values for *someAction* will depend on the widget's
335class: ``.fred disable`` works if fred is a button (fred gets greyed out), but
336does not work if fred is a label (disabling of labels is not supported in Tk).
337
338The legal values of *someOptions* is action dependent.  Some actions, like
379methods. See the :mod:`Tix` module documentation for additional information on
380the Form geometry manager. ::
381
382   pack .fred -side left       =====>  fred.pack(side = "left")
383
384
385How Tk and Tkinter are Related
386------------------------------
n387- 
388-.. % Relationship.html
389- 
390-.. note::
391- 
392-   This was derived from a graphical image; the image will be used more directly in
393-   a subsequent version of this document.
394
395From the top down:
396
397Your App Here (Python)
398   A Python application makes a :mod:`Tkinter` call.
399
400Tkinter (Python Module)
401   This call (say, for example, creating a button widget), is implemented in the
499their values.  This is meant only as an example.
500
501
502The Packer
503^^^^^^^^^^
504
505.. index:: single: packing (widgets)
506
n507-.. % Packer.html
508- 
509The packer is one of Tk's geometry-management mechanisms.    Geometry managers
510are used to specify the relative positioning of the positioning of widgets
511within their container - their mutual *master*.  In contrast to the more
512cumbersome *placer* (which is used less commonly, and we do not cover here), the
513packer takes qualitative relationship specification - *above*, *to the left of*,
514*filling*, etc - and works everything out to determine the exact placement
515coordinates for you.
516
n517-.. % See also \citetitle[classes/ClassPacker.html]{the Packer class interface}.
518- 
519The size of any *master* widget is determined by the size of the "slave widgets"
520inside.  The packer is used to control where slave widgets appear inside the
521master into which they are packed.  You can pack widgets into frames, and frames
522into other frames, in order to achieve the kind of layout you desire.
523Additionally, the arrangement is dynamically adjusted to accommodate incremental
524changes to the configuration, once it is packed.
525
526Note that widgets do not appear until they have had their geometry specified
539
540
541Packer Options
542^^^^^^^^^^^^^^
543
544For more extensive information on the packer and the options that it can take,
545see the man pages and page 183 of John Ousterhout's book.
546
n547-anchor 
n493+anchor
548   Anchor type.  Denotes where the packer is to place each slave in its parcel.
549
550expand
551   Boolean, ``0`` or ``1``.
552
553fill
554   Legal values: ``'x'``, ``'y'``, ``'both'``, ``'none'``.
555
566Coupling Widget Variables
567^^^^^^^^^^^^^^^^^^^^^^^^^
568
569The current-value setting of some widgets (like text entry widgets) can be
570connected directly to application variables by using special options.  These
571options are ``variable``, ``textvariable``, ``onvalue``, ``offvalue``, and
572``value``.  This connection works both ways: if the variable changes for any
573reason, the widget it's connected to will be updated to reflect the new value.
n574- 
575-.. % VarCouplings.html
576
577Unfortunately, in the current implementation of :mod:`Tkinter` it is not
578possible to hand over an arbitrary Python variable to a widget through a
579``variable`` or ``textvariable`` option.  The only kinds of variables for which
580this works are variables that are subclassed from a class called Variable,
581defined in the :mod:`Tkinter` module.
582
583There are many useful subclasses of Variable already defined:
615                 self.contents.get()
616
617
618The Window Manager
619^^^^^^^^^^^^^^^^^^
620
621.. index:: single: window manager (widgets)
622
n623-.. % WindowMgr.html
624- 
625In Tk, there is a utility command, ``wm``, for interacting with the window
626manager.  Options to the ``wm`` command allow you to control things like titles,
627placement, icon bitmaps, and the like.  In :mod:`Tkinter`, these commands have
628been implemented as methods on the :class:`Wm` class.  Toplevel widgets are
629subclassed from the :class:`Wm` class, and so can call the :class:`Wm` methods
630directly.
631
632To get at the toplevel window that contains a given widget, you can often just
633refer to the widget's master.  Of course if the widget has been packed inside of
634a frame, the master won't represent a toplevel window.  To get at the toplevel
635window that contains an arbitrary widget, you can call the :meth:`_root` method.
636This method begins with an underscore to denote the fact that this function is
637part of the implementation, and not an interface to Tk functionality.
638
n639-.. % See also \citetitle[classes/ClassWm.html]{the Wm class interface}.
640- 
641Here are some examples of typical usage::
642
643   from Tkinter import *
644   class App(Frame):
645       def __init__(self, master=None):
646           Frame.__init__(self, master)
647           self.pack()
648
659   # start the program
660   myapp.mainloop()
661
662
663Tk Option Data Types
664^^^^^^^^^^^^^^^^^^^^
665
666.. index:: single: Tk Option Data Types
n667- 
668-.. % OptionTypes.html
669
670anchor
671   Legal values are points of the compass: ``"n"``, ``"ne"``, ``"e"``, ``"se"``,
672   ``"s"``, ``"sw"``, ``"w"``, ``"nw"``, and also ``"center"``.
673
674bitmap
675   There are eight built-in, named bitmaps: ``'error'``, ``'gray25'``,
676   ``'gray50'``, ``'hourglass'``, ``'info'``, ``'questhead'``, ``'question'``,
741
742Bindings and Events
743^^^^^^^^^^^^^^^^^^^
744
745.. index::
746   single: bind (widgets)
747   single: events (widgets)
748
n749-.. % Bindings.html
750- 
751The bind method from the widget command allows you to watch for certain events
752and to have a callback function trigger when that event type occurs.  The form
753of the bind method is::
754
755   def bind(self, sequence, func, add=''):
756
757where:
758
761   page 201 of John Ousterhout's book for details).
762
763func
764   is a Python function, taking one argument, to be invoked when the event occurs.
765   An Event instance will be passed as the argument. (Functions deployed this way
766   are commonly known as *callbacks*.)
767
768add
n769-   is optional, either ```` or``+``.  Passing an empty string denotes that this
n705+   is optional, either ``''`` or ``'+'``.  Passing an empty string denotes that
770-   binding is to replace any other bindings that this event is associated with.
706+   this binding is to replace any other bindings that this event is associated
771-   Preceeding with a``+`` means that this function is to be added to the list of
707+   with.  Passing a ``'+'`` means that this function is to be added to the list
772-   functions bound to this event type.
708+   of functions bound to this event type.
773
774For example::
775
776   def turnRed(self, event):
777       event.widget["activeforeground"] = "red"
778
779   self.button.bind("<Enter>", self.turnRed)
780
781Notice how the widget field of the event is being accessed in the
782:meth:`turnRed` callback.  This field contains the widget that caught the X
783event.  The following table lists the other event fields you can access, and how
784they are denoted in Tk, which can be useful when referring to the Tk man pages.
785::
786
n787-   Tk      Tkinter Event Field             Tk      Tkinter Event Field 
n723+   Tk      Tkinter Event Field             Tk      Tkinter Event Field
788   --      -------------------             --      -------------------
789   %f      focus                           %A      char
790   %h      height                          %E      send_event
791   %k      keycode                         %K      keysym
792   %s      state                           %N      keysym_num
793   %t      time                            %T      type
794   %w      width                           %W      widget
795   %x      x                               %X      x_root
798
799The index Parameter
800^^^^^^^^^^^^^^^^^^^
801
802A number of widgets require"index" parameters to be passed.  These are used to
803point at a specific place in a Text widget, or to particular characters in an
804Entry widget, or to particular menu items in a Menu widget.
805
n806-.. % Index.html
807- 
808Entry widget indexes (index, view index, etc.)
809   Entry widgets have options that refer to character positions in the text being
810   displayed.  You can use these :mod:`Tkinter` functions to access these special
811   points in text widgets:
812
813   AtEnd()
814      refers to the last position in the text
815
829Text widget indexes
830   The index notation for Text widgets is very rich and is best described in the Tk
831   man pages.
832
833Menu indexes (menu.invoke(), menu.entryconfig(), etc.)
834   Some options and methods for menus manipulate specific menu entries. Anytime a
835   menu index is needed for an option or a parameter, you may pass in:
836
n837-* an integer which refers to the numeric position of the entry in the widget,
n771+   * an integer which refers to the numeric position of the entry in the widget,
838     counted from the top, starting with 0;
839
n840-* the string ``'active'``, which refers to the menu position that is currently
n774+   * the string ``'active'``, which refers to the menu position that is currently
841     under the cursor;
842
n843-* the string ``"last"`` which refers to the last menu item;
n777+   * the string ``"last"`` which refers to the last menu item;
844
n845-* An integer preceded by ``@``, as in ``@6``, where the integer is interpreted
n779+   * An integer preceded by ``@``, as in ``@6``, where the integer is interpreted
846     as a y pixel coordinate in the menu's coordinate system;
847
n848-* the string ``"none"``, which indicates no menu entry at all, most often used
n782+   * the string ``"none"``, which indicates no menu entry at all, most often used
849     with menu.activate() to deactivate all entries, and finally,
850
n851-* a text string that is pattern matched against the label of the menu entry, as
n785+   * a text string that is pattern matched against the label of the menu entry, as
852     scanned from the top of the menu to the bottom.  Note that this index type is
853     considered after all the others, which means that matches for menu items
854     labelled ``last``, ``active``, or ``none`` may be interpreted as the above
855     literals, instead.
856
857
858Images
859^^^^^^
869option (other options are available as well).
870
871The image object can then be used wherever an ``image`` option is supported by
872some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a
873reference to the image. When the last Python reference to the image object is
874deleted, the image data is deleted as well, and Tk will display an empty box
875wherever the image was used.
876
t877- 
878-:mod:`Tix` --- Extension widgets for Tk
879-=======================================
880- 
881-.. module:: Tix
882-   :synopsis: Tk Extension Widgets for Tkinter
883-.. sectionauthor:: Mike Clarkson <mikeclarkson@users.sourceforge.net>
884- 
885- 
886-.. index:: single: Tix
887- 
888-The :mod:`Tix` (Tk Interface Extension) module provides an additional rich set
889-of widgets. Although the standard Tk library has many useful widgets, they are
890-far from complete. The :mod:`Tix` library provides most of the commonly needed
891-widgets that are missing from standard Tk: :class:`HList`, :class:`ComboBox`,
892-:class:`Control` (a.k.a. SpinBox) and an assortment of scrollable widgets.
893-:mod:`Tix` also includes many more widgets that are generally useful in a wide
894-range of applications: :class:`NoteBook`, :class:`FileEntry`,
895-:class:`PanedWindow`, etc; there are more than 40 of them.
896- 
897-With all these new widgets, you can introduce new interaction techniques into
898-applications, creating more useful and more intuitive user interfaces. You can
899-design your application by choosing the most appropriate widgets to match the
900-special needs of your application and users.
901- 
902- 
903-.. seealso::
904- 
905-   `Tix Homepage <http://tix.sourceforge.net/>`_
906-      The home page for :mod:`Tix`.  This includes links to additional documentation
907-      and downloads.
908- 
909-   `Tix Man Pages <http://tix.sourceforge.net/dist/current/man/>`_
910-      On-line version of the man pages and reference material.
911- 
912-   `Tix Programming Guide <http://tix.sourceforge.net/dist/current/docs/tix-book/tix.book.html>`_
913-      On-line version of the programmer's reference material.
914- 
915-   `Tix Development Applications <http://tix.sourceforge.net/Tide/>`_
916-      Tix applications for development of Tix and Tkinter programs. Tide applications
917-      work under Tk or Tkinter, and include :program:`TixInspect`, an inspector to
918-      remotely modify and debug Tix/Tk/Tkinter applications.
919- 
920- 
921-Using Tix
922----------
923- 
924- 
925-.. class:: Tix(screenName[, baseName[, className]])
926- 
927-   Toplevel widget of Tix which represents mostly the main window of an
928-   application. It has an associated Tcl interpreter.
929- 
930-   Classes in the :mod:`Tix` module subclasses the classes in the :mod:`Tkinter`
931-   module. The former imports the latter, so to use :mod:`Tix` with Tkinter, all
932-   you need to do is to import one module. In general, you can just import
933-   :mod:`Tix`, and replace the toplevel call to :class:`Tkinter.Tk` with
934-   :class:`Tix.Tk`::
935- 
936-      import Tix
937-      from Tkconstants import *
938-      root = Tix.Tk()
939- 
940-To use :mod:`Tix`, you must have the :mod:`Tix` widgets installed, usually
941-alongside your installation of the Tk widgets. To test your installation, try
942-the following::
943- 
944-   import Tix
945-   root = Tix.Tk()
946-   root.tk.eval('package require Tix')
947- 
948-If this fails, you have a Tk installation problem which must be resolved before
949-proceeding. Use the environment variable :envvar:`TIX_LIBRARY` to point to the
950-installed :mod:`Tix` library directory, and make sure you have the dynamic
951-object library (:file:`tix8183.dll` or :file:`libtix8183.so`) in  the same
952-directory that contains your Tk dynamic object library (:file:`tk8183.dll` or
953-:file:`libtk8183.so`). The directory with the dynamic object library should also
954-have a file called :file:`pkgIndex.tcl` (case sensitive), which contains the
955-line::
956- 
957-   package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]
958- 
959-.. % $ <-- bow to font-lock
960- 
961- 
962-Tix Widgets
963------------
964- 
965-`Tix <http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm>`_
966-introduces over 40 widget classes to the :mod:`Tkinter`  repertoire.  There is a
967-demo of all the :mod:`Tix` widgets in the :file:`Demo/tix` directory of the
968-standard distribution.
969- 
970-.. % The Python sample code is still being added to Python, hence commented out
971- 
972- 
973-Basic Widgets
974-^^^^^^^^^^^^^
975- 
976- 
977-.. class:: Balloon()
978- 
979-   A `Balloon
980-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixBalloon.htm>`_ that
981-   pops up over a widget to provide help.  When the user moves the cursor inside a
982-   widget to which a Balloon widget has been bound, a small pop-up window with a
983-   descriptive message will be shown on the screen.
984- 
985-.. % Python Demo of:
986-.. % \ulink{Balloon}{http://tix.sourceforge.net/dist/current/demos/samples/Balloon.tcl}
987- 
988- 
989-.. class:: ButtonBox()
990- 
991-   The `ButtonBox
992-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixButtonBox.htm>`_
993-   widget creates a box of buttons, such as is commonly used for ``Ok Cancel``.
994- 
995-.. % Python Demo of:
996-.. % \ulink{ButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/BtnBox.tcl}
997- 
998- 
999-.. class:: ComboBox()
1000- 
1001-   The `ComboBox
1002-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixComboBox.htm>`_
1003-   widget is similar to the combo box control in MS Windows. The user can select a
1004-   choice by either typing in the entry subwdget or selecting from the listbox
1005-   subwidget.
1006- 
1007-.. % Python Demo of:
1008-.. % \ulink{ComboBox}{http://tix.sourceforge.net/dist/current/demos/samples/ComboBox.tcl}
1009- 
1010- 
1011-.. class:: Control()
1012- 
1013-   The `Control
1014-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixControl.htm>`_
1015-   widget is also known as the :class:`SpinBox` widget. The user can adjust the
1016-   value by pressing the two arrow buttons or by entering the value directly into
1017-   the entry. The new value will be checked against the user-defined upper and
1018-   lower limits.
1019- 
1020-.. % Python Demo of:
1021-.. % \ulink{Control}{http://tix.sourceforge.net/dist/current/demos/samples/Control.tcl}
1022- 
1023- 
1024-.. class:: LabelEntry()
1025- 
1026-   The `LabelEntry
1027-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelEntry.htm>`_
1028-   widget packages an entry widget and a label into one mega widget. It can be used
1029-   be used to simplify the creation of "entry-form" type of interface.
1030- 
1031-.. % Python Demo of:
1032-.. % \ulink{LabelEntry}{http://tix.sourceforge.net/dist/current/demos/samples/LabEntry.tcl}
1033- 
1034- 
1035-.. class:: LabelFrame()
1036- 
1037-   The `LabelFrame
1038-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelFrame.htm>`_
1039-   widget packages a frame widget and a label into one mega widget.  To create
1040-   widgets inside a LabelFrame widget, one creates the new widgets relative to the
1041-   :attr:`frame` subwidget and manage them inside the :attr:`frame` subwidget.
1042- 
1043-.. % Python Demo of:
1044-.. % \ulink{LabelFrame}{http://tix.sourceforge.net/dist/current/demos/samples/LabFrame.tcl}
1045- 
1046- 
1047-.. class:: Meter()
1048- 
1049-   The `Meter
1050-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixMeter.htm>`_ widget
1051-   can be used to show the progress of a background job which may take a long time
1052-   to execute.
1053- 
1054-.. % Python Demo of:
1055-.. % \ulink{Meter}{http://tix.sourceforge.net/dist/current/demos/samples/Meter.tcl}
1056- 
1057- 
1058-.. class:: OptionMenu()
1059- 
1060-   The `OptionMenu
1061-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixOptionMenu.htm>`_
1062-   creates a menu button of options.
1063- 
1064-.. % Python Demo of:
1065-.. % \ulink{OptionMenu}{http://tix.sourceforge.net/dist/current/demos/samples/OptMenu.tcl}
1066- 
1067- 
1068-.. class:: PopupMenu()
1069- 
1070-   The `PopupMenu
1071-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPopupMenu.htm>`_
1072-   widget can be used as a replacement of the ``tk_popup`` command. The advantage
1073-   of the :mod:`Tix` :class:`PopupMenu` widget is it requires less application code
1074-   to manipulate.
1075- 
1076-.. % Python Demo of:
1077-.. % \ulink{PopupMenu}{http://tix.sourceforge.net/dist/current/demos/samples/PopMenu.tcl}
1078- 
1079- 
1080-.. class:: Select()
1081- 
1082-   The `Select
1083-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixSelect.htm>`_ widget
1084-   is a container of button subwidgets. It can be used to provide radio-box or
1085-   check-box style of selection options for the user.
1086- 
1087-.. % Python Demo of:
1088-.. % \ulink{Select}{http://tix.sourceforge.net/dist/current/demos/samples/Select.tcl}
1089- 
1090- 
1091-.. class:: StdButtonBox()
1092- 
1093-   The `StdButtonBox
1094-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixStdButtonBox.htm>`_
1095-   widget is a group of standard buttons for Motif-like dialog boxes.
1096- 
1097-.. % Python Demo of:
1098-.. % \ulink{StdButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/StdBBox.tcl}
1099- 
1100- 
1101-File Selectors
1102-^^^^^^^^^^^^^^
1103- 
1104- 
1105-.. class:: DirList()
1106- 
1107-   The `DirList
1108-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirList.htm>`_
1109-   widget displays a list view of a directory, its previous directories and its
1110-   sub-directories. The user can choose one of the directories displayed in the
1111-   list or change to another directory.
1112- 
1113-.. % Python Demo of:
1114-.. % \ulink{DirList}{http://tix.sourceforge.net/dist/current/demos/samples/DirList.tcl}
1115- 
1116- 
1117-.. class:: DirTree()
1118- 
1119-   The `DirTree
1120-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirTree.htm>`_
1121-   widget displays a tree view of a directory, its previous directories and its
1122-   sub-directories. The user can choose one of the directories displayed in the
1123-   list or change to another directory.
1124- 
1125-.. % Python Demo of:
1126-.. % \ulink{DirTree}{http://tix.sourceforge.net/dist/current/demos/samples/DirTree.tcl}
1127- 
1128- 
1129-.. class:: DirSelectDialog()
1130- 
1131-   The `DirSelectDialog
1132-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirSelectDialog.htm>`_
1133-   widget presents the directories in the file system in a dialog window.  The user
1134-   can use this dialog window to navigate through the file system to select the
1135-   desired directory.
1136- 
1137-.. % Python Demo of:
1138-.. % \ulink{DirSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/DirDlg.tcl}
1139- 
1140- 
1141-.. class:: DirSelectBox()
1142- 
1143-   The :class:`DirSelectBox` is similar to the standard Motif(TM) directory-
1144-   selection box. It is generally used for the user to choose a directory.
1145-   DirSelectBox stores the directories mostly recently selected into a ComboBox
1146-   widget so that they can be quickly selected again.
1147- 
1148- 
1149-.. class:: ExFileSelectBox()
1150- 
1151-   The `ExFileSelectBox
1152-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm>`_
1153-   widget is usually embedded in a tixExFileSelectDialog widget. It provides an
1154-   convenient method for the user to select files. The style of the
1155-   :class:`ExFileSelectBox` widget is very similar to the standard file dialog on
1156-   MS Windows 3.1.
1157- 
1158-.. % Python Demo of:
1159-.. % \ulink{ExFileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/EFileDlg.tcl}
1160- 
1161- 
1162-.. class:: FileSelectBox()
1163- 
1164-   The `FileSelectBox
1165-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileSelectBox.htm>`_
1166-   is similar to the standard Motif(TM) file-selection box. It is generally used
1167-   for the user to choose a file. FileSelectBox stores the files mostly recently
1168-   selected into a :class:`ComboBox` widget so that they can be quickly selected
1169-   again.
1170- 
1171-.. % Python Demo of:
1172-.. % \ulink{FileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/FileDlg.tcl}
1173- 
1174- 
1175-.. class:: FileEntry()
1176- 
1177-   The `FileEntry
1178-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileEntry.htm>`_
1179-   widget can be used to input a filename. The user can type in the filename
1180-   manually. Alternatively, the user can press the button widget that sits next to
1181-   the entry, which will bring up a file selection dialog.
1182- 
1183-.. % Python Demo of:
1184-.. % \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl}
1185- 
1186- 
1187-Hierachical ListBox
1188-^^^^^^^^^^^^^^^^^^^
1189- 
1190- 
1191-.. class:: HList()
1192- 
1193-   The `HList
1194-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixHList.htm>`_ widget
1195-   can be used to display any data that have a hierarchical structure, for example,
1196-   file system directory trees. The list entries are indented and connected by
1197-   branch lines according to their places in the hierarchy.
1198- 
1199-.. % Python Demo of:
1200-.. % \ulink{HList}{http://tix.sourceforge.net/dist/current/demos/samples/HList1.tcl}
1201- 
1202- 
1203-.. class:: CheckList()
1204- 
1205-   The `CheckList
1206-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixCheckList.htm>`_
1207-   widget displays a list of items to be selected by the user. CheckList acts
1208-   similarly to the Tk checkbutton or radiobutton widgets, except it is capable of
1209-   handling many more items than checkbuttons or radiobuttons.
1210- 
1211-.. % Python Demo of:
1212-.. % \ulink{ CheckList}{http://tix.sourceforge.net/dist/current/demos/samples/ChkList.tcl}
1213-.. % Python Demo of:
1214-.. % \ulink{ScrolledHList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList.tcl}
1215-.. % Python Demo of:
1216-.. % \ulink{ScrolledHList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList2.tcl}
1217- 
1218- 
1219-.. class:: Tree()
1220- 
1221-   The `Tree
1222-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTree.htm>`_ widget
1223-   can be used to display hierarchical data in a tree form. The user can adjust the
1224-   view of the tree by opening or closing parts of the tree.
1225- 
1226-.. % Python Demo of:
1227-.. % \ulink{Tree}{http://tix.sourceforge.net/dist/current/demos/samples/Tree.tcl}
1228-.. % Python Demo of:
1229-.. % \ulink{Tree (Dynamic)}{http://tix.sourceforge.net/dist/current/demos/samples/DynTree.tcl}
1230- 
1231- 
1232-Tabular ListBox
1233-^^^^^^^^^^^^^^^
1234- 
1235- 
1236-.. class:: TList()
1237- 
1238-   The `TList
1239-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTList.htm>`_ widget
1240-   can be used to display data in a tabular format. The list entries of a
1241-   :class:`TList` widget are similar to the entries in the Tk listbox widget.  The
1242-   main differences are (1) the :class:`TList` widget can display the list entries
1243-   in a two dimensional format and (2) you can use graphical images as well as
1244-   multiple colors and fonts for the list entries.
1245- 
1246-.. % Python Demo of:
1247-.. % \ulink{ScrolledTList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/STList1.tcl}
1248-.. % Python Demo of:
1249-.. % \ulink{ScrolledTList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/STList2.tcl}
1250-.. % Grid has yet to be added to Python
1251-.. % \subsubsection{Grid Widget}
1252-.. % Python Demo of:
1253-.. % \ulink{Simple Grid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid0.tcl}
1254-.. % Python Demo of:
1255-.. % \ulink{ScrolledGrid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid1.tcl}
1256-.. % Python Demo of:
1257-.. % \ulink{Editable Grid}{http://tix.sourceforge.net/dist/current/demos/samples/EditGrid.tcl}
1258- 
1259- 
1260-Manager Widgets
1261-^^^^^^^^^^^^^^^
1262- 
1263- 
1264-.. class:: PanedWindow()
1265- 
1266-   The `PanedWindow
1267-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPanedWindow.htm>`_
1268-   widget allows the user to interactively manipulate the sizes of several panes.
1269-   The panes can be arranged either vertically or horizontally.  The user changes
1270-   the sizes of the panes by dragging the resize handle between two panes.
1271- 
1272-.. % Python Demo of:
1273-.. % \ulink{PanedWindow}{http://tix.sourceforge.net/dist/current/demos/samples/PanedWin.tcl}
1274- 
1275- 
1276-.. class:: ListNoteBook()
1277- 
1278-   The `ListNoteBook
1279-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixListNoteBook.htm>`_
1280-   widget is very similar to the :class:`TixNoteBook` widget: it can be used to
1281-   display many windows in a limited space using a notebook metaphor. The notebook
1282-   is divided into a stack of pages (windows). At one time only one of these pages
1283-   can be shown. The user can navigate through these pages by choosing the name of
1284-   the desired page in the :attr:`hlist` subwidget.
1285- 
1286-.. % Python Demo of:
1287-.. % \ulink{ListNoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/ListNBK.tcl}
1288- 
1289- 
1290-.. class:: NoteBook()
1291- 
1292-   The `NoteBook
1293-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixNoteBook.htm>`_
1294-   widget can be used to display many windows in a limited space using a notebook
1295-   metaphor. The notebook is divided into a stack of pages. At one time only one of
1296-   these pages can be shown. The user can navigate through these pages by choosing
1297-   the visual "tabs" at the top of the NoteBook widget.
1298- 
1299-.. % Python Demo of:
1300-.. % \ulink{NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/NoteBook.tcl}
1301- 
1302-.. % \subsubsection{Scrolled Widgets}
1303-.. % Python Demo of:
1304-.. % \ulink{ScrolledListBox}{http://tix.sourceforge.net/dist/current/demos/samples/SListBox.tcl}
1305-.. % Python Demo of:
1306-.. % \ulink{ScrolledText}{http://tix.sourceforge.net/dist/current/demos/samples/SText.tcl}
1307-.. % Python Demo of:
1308-.. % \ulink{ScrolledWindow}{http://tix.sourceforge.net/dist/current/demos/samples/SWindow.tcl}
1309-.. % Python Demo of:
1310-.. % \ulink{Canvas Object View}{http://tix.sourceforge.net/dist/current/demos/samples/CObjView.tcl}
1311- 
1312- 
1313-Image Types
1314-^^^^^^^^^^^
1315- 
1316-The :mod:`Tix` module adds:
1317- 
1318-* `pixmap <http://tix.sourceforge.net/dist/current/man/html/TixCmd/pixmap.htm>`_
1319-  capabilities to all :mod:`Tix` and :mod:`Tkinter` widgets to create color images
1320-  from XPM files.
1321- 
1322-  .. % Python Demo of:
1323-  .. % \ulink{XPM Image In Button}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm.tcl}
1324-  .. % Python Demo of:
1325-  .. % \ulink{XPM Image In Menu}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm1.tcl}
1326- 
1327-* `Compound
1328-  <http://tix.sourceforge.net/dist/current/man/html/TixCmd/compound.htm>`_ image
1329-  types can be used to create images that consists of multiple horizontal lines;
1330-  each line is composed of a series of items (texts, bitmaps, images or spaces)
1331-  arranged from left to right. For example, a compound image can be used to
1332-  display a bitmap and a text string simultaneously in a Tk :class:`Button`
1333-  widget.
1334- 
1335-  .. % Python Demo of:
1336-  .. % \ulink{Compound Image In Buttons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg.tcl}
1337-  .. % Python Demo of:
1338-  .. % \ulink{Compound Image In NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg2.tcl}
1339-  .. % Python Demo of:
1340-  .. % \ulink{Compound Image Notebook Color Tabs}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg4.tcl}
1341-  .. % Python Demo of:
1342-  .. % \ulink{Compound Image Icons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg3.tcl}
1343- 
1344- 
1345-Miscellaneous Widgets
1346-^^^^^^^^^^^^^^^^^^^^^
1347- 
1348- 
1349-.. class:: InputOnly()
1350- 
1351-   The `InputOnly
1352-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixInputOnly.htm>`_
1353-   widgets are to accept inputs from the user, which can be done with the ``bind``
1354-   command (Unix only).
1355- 
1356- 
1357-Form Geometry Manager
1358-^^^^^^^^^^^^^^^^^^^^^
1359- 
1360-In addition, :mod:`Tix` augments :mod:`Tkinter` by providing:
1361- 
1362- 
1363-.. class:: Form()
1364- 
1365-   The `Form
1366-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm>`_ geometry
1367-   manager based on attachment rules for all Tk widgets.
1368- 
1369-.. % begin{latexonly}
1370-.. % \subsection{Tix Class Structure}
1371-.. % 
1372-.. % \begin{figure}[hbtp]
1373-.. % \centerline{\epsfig{file=hierarchy.png,width=.9\textwidth}}
1374-.. % \vspace{.5cm}
1375-.. % \caption{The Class Hierarchy of Tix Widgets}
1376-.. % \end{figure}
1377-.. % end{latexonly}
1378- 
1379- 
1380-Tix Commands
1381-------------
1382- 
1383- 
1384-.. class:: tixCommand()
1385- 
1386-   The `tix commands
1387-   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tix.htm>`_ provide
1388-   access to miscellaneous elements of :mod:`Tix`'s internal state and the
1389-   :mod:`Tix` application context.  Most of the information manipulated by these
1390-   methods pertains to the application as a whole, or to a screen or display,
1391-   rather than to a particular window.
1392- 
1393-   To view the current settings, the common usage is::
1394- 
1395-      import Tix
1396-      root = Tix.Tk()
1397-      print root.tix_configure()
1398- 
1399- 
1400-.. method:: tixCommand.tix_configure([cnf,] **kw)
1401- 
1402-   Query or modify the configuration options of the Tix application context. If no
1403-   option is specified, returns a dictionary all of the available options.  If
1404-   option is specified with no value, then the method returns a list describing the
1405-   one named option (this list will be identical to the corresponding sublist of
1406-   the value returned if no option is specified).  If one or more option-value
1407-   pairs are specified, then the method modifies the given option(s) to have the
1408-   given value(s); in this case the method returns an empty string. Option may be
1409-   any of the configuration options.
1410- 
1411- 
1412-.. method:: tixCommand.tix_cget(option)
1413- 
1414-   Returns the current value of the configuration option given by *option*. Option
1415-   may be any of the configuration options.
1416- 
1417- 
1418-.. method:: tixCommand.tix_getbitmap(name)
1419- 
1420-   Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the bitmap
1421-   directories (see the :meth:`tix_addbitmapdir` method).  By using
1422-   :meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap
1423-   files in your application. When successful, it returns the complete pathname of
1424-   the bitmap file, prefixed with the character ``@``.  The returned value can be
1425-   used to configure the ``bitmap`` option of the Tk and Tix widgets.
1426- 
1427- 
1428-.. method:: tixCommand.tix_addbitmapdir(directory)
1429- 
1430-   Tix maintains a list of directories under which the :meth:`tix_getimage` and
1431-   :meth:`tix_getbitmap` methods will search for image files.  The standard bitmap
1432-   directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:`tix_addbitmapdir` method
1433-   adds *directory* into this list. By using this method, the image files of an
1434-   applications can also be located using the :meth:`tix_getimage` or
1435-   :meth:`tix_getbitmap` method.
1436- 
1437- 
1438-.. method:: tixCommand.tix_filedialog([dlgclass])
1439- 
1440-   Returns the file selection dialog that may be shared among different calls from
1441-   this application.  This method will create a file selection dialog widget when
1442-   it is called the first time. This dialog will be returned by all subsequent
1443-   calls to :meth:`tix_filedialog`.  An optional dlgclass parameter can be passed
1444-   as a string to specified what type of file selection dialog widget is desired.
1445-   Possible options are ``tix``, ``FileSelectDialog`` or ``tixExFileSelectDialog``.
1446- 
1447- 
1448-.. method:: tixCommand.tix_getimage(self, name)
1449- 
1450-   Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or
1451-   :file:`name.ppm` in one of the bitmap directories (see the
1452-   :meth:`tix_addbitmapdir` method above). If more than one file with the same name
1453-   (but different extensions) exist, then the image type is chosen according to the
1454-   depth of the X display: xbm images are chosen on monochrome displays and color
1455-   images are chosen on color displays. By using :meth:`tix_getimage`, you can
1456-   avoid hard coding the pathnames of the image files in your application. When
1457-   successful, this method returns the name of the newly created image, which can
1458-   be used to configure the ``image`` option of the Tk and Tix widgets.
1459- 
1460- 
1461-.. method:: tixCommand.tix_option_get(name)
1462- 
1463-   Gets the options maintained by the Tix scheme mechanism.
1464- 
1465- 
1466-.. method:: tixCommand.tix_resetoptions(newScheme, newFontSet[, newScmPrio])
1467- 
1468-   Resets the scheme and fontset of the Tix application to *newScheme* and
1469-   *newFontSet*, respectively.  This affects only those widgets created after this
1470-   call.  Therefore, it is best to call the resetoptions method before the creation
1471-   of any widgets in a Tix application.
1472- 
1473-   The optional parameter *newScmPrio* can be given to reset the priority level of
1474-   the Tk options set by the Tix schemes.
1475- 
1476-   Because of the way Tk handles the X option database, after Tix has been has
1477-   imported and inited, it is not possible to reset the color schemes and font sets
1478-   using the :meth:`tix_config` method. Instead, the :meth:`tix_resetoptions`
1479-   method must be used.
1480- 
1481- 
1482-:mod:`ScrolledText` --- Scrolled Text Widget
1483-============================================
1484- 
1485-.. module:: ScrolledText
1486-   :platform: Tk
1487-   :synopsis: Text widget with a vertical scroll bar.
1488-.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
1489- 
1490- 
1491-The :mod:`ScrolledText` module provides a class of the same name which
1492-implements a basic text widget which has a vertical scroll bar configured to do
1493-the "right thing."  Using the :class:`ScrolledText` class is a lot easier than
1494-setting up a text widget and scroll bar directly.  The constructor is the same
1495-as that of the :class:`Tkinter.Text` class.
1496- 
1497-The text widget and scrollbar are packed together in a :class:`Frame`, and the
1498-methods of the :class:`Grid` and :class:`Pack` geometry managers are acquired
1499-from the :class:`Frame` object.  This allows the :class:`ScrolledText` widget to
1500-be used directly to achieve most normal geometry management behavior.
1501- 
1502-Should more specific control be necessary, the following attributes are
1503-available:
1504- 
1505- 
1506-.. attribute:: ScrolledText.frame
1507- 
1508-   The frame which surrounds the text and scroll bar widgets.
1509- 
1510- 
1511-.. attribute:: ScrolledText.vbar
1512- 
1513-   The scroll bar widget.
1514- 
1515-XXX: input{libturtle} :XXX
1516- 
1517-.. _idle:
1518- 
1519-Idle
1520-====
1521- 
1522-.. moduleauthor:: Guido van Rossum <guido@Python.org>
1523- 
1524- 
1525-.. % \declaremodule{standard}{idle}
1526-.. % \modulesynopsis{A Python Integrated Development Environment}
1527- 
1528-.. index::
1529-   single: Idle
1530-   single: Python Editor
1531-   single: Integrated Development Environment
1532- 
1533-Idle is the Python IDE built with the :mod:`Tkinter` GUI toolkit.
1534- 
1535-IDLE has the following features:
1536- 
1537-* coded in 100% pure Python, using the :mod:`Tkinter` GUI toolkit
1538- 
1539-* cross-platform: works on Windows and Unix (on Mac OS, there are currently
1540-  problems with Tcl/Tk)
1541- 
1542-* multi-window text editor with multiple undo, Python colorizing and many other
1543-  features, e.g. smart indent and call tips
1544- 
1545-* Python shell window (a.k.a. interactive interpreter)
1546- 
1547-* debugger (not complete, but you can set breakpoints, view  and step)
1548- 
1549- 
1550-Menus
1551------
1552- 
1553- 
1554-File menu
1555-^^^^^^^^^
1556- 
1557-New window
1558-   create a new editing window
1559- 
1560-Open...
1561-   open an existing file
1562- 
1563-Open module...
1564-   open an existing module (searches sys.path)
1565- 
1566-Class browser
1567-   show classes and methods in current file
1568- 
1569-Path browser
1570-   show sys.path directories, modules, classes and methods
1571- 
1572-.. index::
1573-   single: Class browser
1574-   single: Path browser
1575- 
1576-Save
1577-   save current window to the associated file (unsaved windows have a \* before and
1578-   after the window title)
1579- 
1580-Save As...
1581-   save current window to new file, which becomes the associated file
1582- 
1583-Save Copy As...
1584-   save current window to different file without changing the associated file
1585- 
1586-Close
1587-   close current window (asks to save if unsaved)
1588- 
1589-Exit
1590-   close all windows and quit IDLE (asks to save if unsaved)
1591- 
1592- 
1593-Edit menu
1594-^^^^^^^^^
1595- 
1596-Undo
1597-   Undo last change to current window (max 1000 changes)
1598- 
1599-Redo
1600-   Redo last undone change to current window
1601- 
1602-Cut
1603-   Copy selection into system-wide clipboard; then delete selection
1604- 
1605-Copy
1606-   Copy selection into system-wide clipboard
1607- 
1608-Paste
1609-   Insert system-wide clipboard into window
1610- 
1611-Select All
1612-   Select the entire contents of the edit buffer
1613- 
1614-Find...
1615-   Open a search dialog box with many options
1616- 
1617-Find again
1618-   Repeat last search
1619- 
1620-Find selection
1621-   Search for the string in the selection
1622- 
1623-Find in Files...
1624-   Open a search dialog box for searching files
1625- 
1626-Replace...
1627-   Open a search-and-replace dialog box
1628- 
1629-Go to line
1630-   Ask for a line number and show that line
1631- 
1632-Indent region
1633-   Shift selected lines right 4 spaces
1634- 
1635-Dedent region
1636-   Shift selected lines left 4 spaces
1637- 
1638-Comment out region
1639-   Insert ## in front of selected lines
1640- 
1641-Uncomment region
1642-   Remove leading # or ## from selected lines
1643- 
1644-Tabify region
1645-   Turns *leading* stretches of spaces into tabs
1646- 
1647-Untabify region
1648-   Turn *all* tabs into the right number of spaces
1649- 
1650-Expand word
1651-   Expand the word you have typed to match another word in the same buffer; repeat
1652-   to get a different expansion
1653- 
1654-Format Paragraph
1655-   Reformat the current blank-line-separated paragraph
1656- 
1657-Import module
1658-   Import or reload the current module
1659- 
1660-Run script
1661-   Execute the current file in the __main__ namespace
1662- 
1663-.. index::
1664-   single: Import module
1665-   single: Run script
1666- 
1667- 
1668-Windows menu
1669-^^^^^^^^^^^^
1670- 
1671-Zoom Height
1672-   toggles the window between normal size (24x80) and maximum height.
1673- 
1674-The rest of this menu lists the names of all open windows; select one to bring
1675-it to the foreground (deiconifying it if necessary).
1676- 
1677- 
1678-Debug menu (in the Python Shell window only)
1679-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1680- 
1681-Go to file/line
1682-   look around the insert point for a filename and linenumber, open the file, and
1683-   show the line.
1684- 
1685-Open stack viewer
1686-   show the stack traceback of the last exception
1687- 
1688-Debugger toggle
1689-   Run commands in the shell under the debugger
1690- 
1691-JIT Stack viewer toggle
1692-   Open stack viewer on traceback
1693- 
1694-.. index::
1695-   single: stack viewer
1696-   single: debugger
1697- 
1698- 
1699-Basic editing and navigation
1700-----------------------------
1701- 
1702-* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right
1703- 
1704-* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around
1705- 
1706-* :kbd:`Home`/:kbd:`End` go to begin/end of line
1707- 
1708-* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file
1709- 
1710-* Some :program:`Emacs` bindings may also work, including :kbd:`C-B`,
1711-  :kbd:`C-P`, :kbd:`C-A`, :kbd:`C-E`, :kbd:`C-D`, :kbd:`C-L`
1712- 
1713- 
1714-Automatic indentation
1715-^^^^^^^^^^^^^^^^^^^^^
1716- 
1717-After a block-opening statement, the next line is indented by 4 spaces (in the
1718-Python Shell window by one tab).  After certain keywords (break, return etc.)
1719-the next line is dedented.  In leading indentation, :kbd:`Backspace` deletes up
1720-to 4 spaces if they are there. :kbd:`Tab` inserts 1-4 spaces (in the Python
1721-Shell window one tab). See also the indent/dedent region commands in the edit
1722-menu.
1723- 
1724- 
1725-Python Shell window
1726-^^^^^^^^^^^^^^^^^^^
1727- 
1728-* :kbd:`C-C` interrupts executing command
1729- 
1730-* :kbd:`C-D` sends end-of-file; closes window if typed at a ``>>>`` prompt
1731- 
1732-* :kbd:`Alt-p` retrieves previous command matching what you have typed
1733- 
1734-* :kbd:`Alt-n` retrieves next
1735- 
1736-* :kbd:`Return` while on any previous command retrieves that command
1737- 
1738-* :kbd:`Alt-/` (Expand word) is also useful here
1739- 
1740-.. index:: single: indentation
1741- 
1742- 
1743-Syntax colors
1744--------------
1745- 
1746-The coloring is applied in a background "thread," so you may occasionally see
1747-uncolorized text.  To change the color scheme, edit the ``[Colors]`` section in
1748-:file:`config.txt`.
1749- 
1750-Python syntax colors:
1751-   Keywords
1752-      orange
1753- 
1754-   Strings 
1755-      green
1756- 
1757-   Comments
1758-      red
1759- 
1760-   Definitions
1761-      blue
1762- 
1763-Shell colors:
1764-   Console output
1765-      brown
1766- 
1767-   stdout
1768-      blue
1769- 
1770-   stderr
1771-      dark green
1772- 
1773-   stdin
1774-      black
1775- 
1776- 
1777-Command line usage
1778-^^^^^^^^^^^^^^^^^^
1779- 
1780-::
1781- 
1782-   idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
1783- 
1784-   -c command  run this command
1785-   -d          enable debugger
1786-   -e          edit mode; arguments are files to be edited
1787-   -s          run $IDLESTARTUP or $PYTHONSTARTUP first
1788-   -t title    set title of shell window
1789- 
1790-If there are arguments:
1791- 
1792-#. If :option:`-e` is used, arguments are files opened for editing and
1793-   ``sys.argv`` reflects the arguments passed to IDLE itself.
1794- 
1795-#. Otherwise, if :option:`-c` is used, all arguments are placed in
1796-   ``sys.argv[1:...]``, with ``sys.argv[0]`` set to ``'-c'``.
1797- 
1798-#. Otherwise, if neither :option:`-e` nor :option:`-c` is used, the first
1799-   argument is a script which is executed with the remaining arguments in
1800-   ``sys.argv[1:...]``  and ``sys.argv[0]`` set to the script name.  If the script
1801-   name is '-', no script is executed but an interactive Python session is started;
1802-   the arguments are still available in ``sys.argv``.
1803- 
1804- 
1805-.. _other-gui-packages:
1806- 
1807-Other Graphical User Interface Packages
1808-=======================================
1809- 
1810-There are an number of extension widget sets to :mod:`Tkinter`.
1811- 
1812- 
1813-.. seealso::
1814- 
1815-   `Python megawidgets <http://pmw.sourceforge.net/>`_
1816-      is a toolkit for building high-level compound widgets in Python using the
1817-      :mod:`Tkinter` module.  It consists of a set of base classes and a library of
1818-      flexible and extensible megawidgets built on this foundation. These megawidgets
1819-      include notebooks, comboboxes, selection widgets, paned widgets, scrolled
1820-      widgets, dialog windows, etc.  Also, with the Pmw.Blt interface to BLT, the
1821-      busy, graph, stripchart, tabset and vector commands are be available.
1822- 
1823-      The initial ideas for Pmw were taken from the Tk ``itcl`` extensions ``[incr
1824-      Tk]`` by Michael McLennan and ``[incr Widgets]`` by Mark Ulferts. Several of the
1825-      megawidgets are direct translations from the itcl to Python. It offers most of
1826-      the range of widgets that ``[incr Widgets]`` does, and is almost as complete as
1827-      Tix, lacking however Tix's fast :class:`HList` widget for drawing trees.
1828- 
1829-   `Tkinter3000 Widget Construction Kit (WCK) <http://tkinter.effbot.org/>`_
1830-      is a library that allows you to write new Tkinter widgets in pure Python.  The
1831-      WCK framework gives you full control over widget creation, configuration, screen
1832-      appearance, and event handling.  WCK widgets can be very fast and light-weight,
1833-      since they can operate directly on Python data structures, without having to
1834-      transfer data through the Tk/Tcl layer.
1835- 
1836-      .. % 
1837- 
1838-Other GUI packages are also available for Python:
1839- 
1840- 
1841-.. seealso::
1842- 
1843-   `wxPython <http://www.wxpython.org>`_
1844-      wxPython is a cross-platform GUI toolkit for Python that is built around the
1845-      popular `wxWidgets <http://www.wxwidgets.org/>`_ C++ toolkit.  It provides a
1846-      native look and feel for applications on Windows, Mac OS X, and Unix systems by
1847-      using each platform's native widgets where ever possible, (GTK+ on Unix-like
1848-      systems).  In addition to an extensive set of widgets, wxPython provides classes
1849-      for online documentation and context sensitive help, printing, HTML viewing,
1850-      low-level device context drawing, drag and drop, system clipboard access, an
1851-      XML-based resource format and more, including an ever growing library of user-
1852-      contributed modules.  Both the wxWidgets and wxPython projects are under active
1853-      development and continuous improvement, and have active and helpful user and
1854-      developer communities.
1855- 
1856-   `wxPython in Action <http://www.amazon.com/exec/obidos/ASIN/1932394621>`_
1857-      The wxPython book, by Noel Rappin and Robin Dunn.
1858- 
1859-   PyQt
1860-      PyQt is a :program:`sip`\ -wrapped binding to the Qt toolkit.  Qt is an
1861-      extensive C++ GUI toolkit that is available for Unix, Windows and Mac OS X.
1862-      :program:`sip` is a tool for generating bindings for C++ libraries as Python
1863-      classes, and is specifically designed for Python. An online manual is available
1864-      at `<http://www.opendocspublishing.com/pyqt/>`_ (errata are located at
1865-      `<http://www.valdyas.org/python/book.html>`_).
1866- 
1867-   `PyKDE <http://www.riverbankcomputing.co.uk/pykde/index.php>`_
1868-      PyKDE is a :program:`sip`\ -wrapped interface to the KDE desktop libraries.  KDE
1869-      is a desktop environment for Unix computers; the graphical components are based
1870-      on Qt.
1871- 
1872-   `FXPy <http://fxpy.sourceforge.net/>`_
1873-      is a Python extension module which provides an interface to the  `FOX
1874-      <http://www.cfdrc.com/FOX/fox.html>`_ GUI. FOX is a C++ based Toolkit for
1875-      developing Graphical User Interfaces easily and effectively. It offers a wide,
1876-      and growing, collection of Controls, and provides state of the art facilities
1877-      such as drag and drop, selection, as well as OpenGL widgets for 3D graphical
1878-      manipulation.  FOX also implements icons, images, and user-convenience features
1879-      such as status line help, and tooltips.
1880- 
1881-      Even though FOX offers a large collection of controls already, FOX leverages C++
1882-      to allow programmers to easily build additional Controls and GUI elements,
1883-      simply by taking existing controls, and creating a derived class which simply
1884-      adds or redefines the desired behavior.
1885- 
1886-   `PyGTK <http://www.daa.com.au/~james/software/pygtk/>`_
1887-      is a set of bindings for the `GTK <http://www.gtk.org/>`_ widget set. It
1888-      provides an object oriented interface that is slightly higher level than the C
1889-      one. It automatically does all the type casting and reference counting that you
1890-      would have to do normally with the C API. There are also `bindings
1891-      <http://www.daa.com.au/~james/gnome/>`_ to  `GNOME <http://www.gnome.org>`_, and
1892-      a  `tutorial
1893-      <http://laguna.fmedic.unam.mx/~daniel/pygtutorial/pygtutorial/index.html>`_ is
1894-      available.
1895- 
1896-.. % XXX Reference URLs that compare the different UI packages
1897- 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op