| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 1 | :mod:`tkinter.tix` --- Extension widgets for Tk | 
 | 2 | =============================================== | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 3 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 4 | .. module:: tkinter.tix | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 5 |    :synopsis: Tk Extension Widgets for Tkinter | 
 | 6 | .. sectionauthor:: Mike Clarkson <mikeclarkson@users.sourceforge.net> | 
 | 7 |  | 
 | 8 |  | 
 | 9 | .. index:: single: Tix | 
 | 10 |  | 
| Georg Brandl | 48310cd | 2009-01-03 21:18:54 +0000 | [diff] [blame] | 11 | The :mod:`tkinter.tix` (Tk Interface Extension) module provides an additional | 
 | 12 | rich set of widgets. Although the standard Tk library has many useful widgets, | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 13 | they are far from complete. The :mod:`tkinter.tix` library provides most of the | 
| Georg Brandl | 48310cd | 2009-01-03 21:18:54 +0000 | [diff] [blame] | 14 | commonly needed widgets that are missing from standard Tk: :class:`HList`, | 
 | 15 | :class:`ComboBox`, :class:`Control` (a.k.a. SpinBox) and an assortment of | 
 | 16 | scrollable widgets. | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 17 | :mod:`tkinter.tix` also includes many more widgets that are generally useful in | 
 | 18 | a wide range of applications: :class:`NoteBook`, :class:`FileEntry`, | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 19 | :class:`PanedWindow`, etc; there are more than 40 of them. | 
 | 20 |  | 
 | 21 | With all these new widgets, you can introduce new interaction techniques into | 
 | 22 | applications, creating more useful and more intuitive user interfaces. You can | 
 | 23 | design your application by choosing the most appropriate widgets to match the | 
 | 24 | special needs of your application and users. | 
 | 25 |  | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 26 | .. seealso:: | 
 | 27 |  | 
 | 28 |    `Tix Homepage <http://tix.sourceforge.net/>`_ | 
 | 29 |       The home page for :mod:`Tix`.  This includes links to additional documentation | 
 | 30 |       and downloads. | 
 | 31 |  | 
 | 32 |    `Tix Man Pages <http://tix.sourceforge.net/dist/current/man/>`_ | 
 | 33 |       On-line version of the man pages and reference material. | 
 | 34 |  | 
 | 35 |    `Tix Programming Guide <http://tix.sourceforge.net/dist/current/docs/tix-book/tix.book.html>`_ | 
 | 36 |       On-line version of the programmer's reference material. | 
 | 37 |  | 
| Christian Heimes | dd15f6c | 2008-03-16 00:07:10 +0000 | [diff] [blame] | 38 |    `Tix Development Applications <http://tix.sourceforge.net/Tixapps/src/Tide.html>`_ | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 39 |       Tix applications for development of Tix and Tkinter programs. Tide applications | 
 | 40 |       work under Tk or Tkinter, and include :program:`TixInspect`, an inspector to | 
 | 41 |       remotely modify and debug Tix/Tk/Tkinter applications. | 
 | 42 |  | 
 | 43 |  | 
 | 44 | Using Tix | 
 | 45 | --------- | 
 | 46 |  | 
 | 47 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 48 | .. class:: Tk(screenName=None, baseName=None, className='Tix') | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 49 |  | 
 | 50 |    Toplevel widget of Tix which represents mostly the main window of an | 
 | 51 |    application. It has an associated Tcl interpreter. | 
 | 52 |  | 
| Georg Brandl | 48310cd | 2009-01-03 21:18:54 +0000 | [diff] [blame] | 53 |    Classes in the :mod:`tkinter.tix` module subclasses the classes in the | 
 | 54 |    :mod:`tkinter`. The former imports the latter, so to use :mod:`tkinter.tix` | 
 | 55 |    with Tkinter, all you need to do is to import one module. In general, you | 
 | 56 |    can just import :mod:`tkinter.tix`, and replace the toplevel call to | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 57 |    :class:`tkinter.Tk` with :class:`tix.Tk`:: | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 58 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 59 |       from tkinter import tix | 
 | 60 |       from tkinter.constants import * | 
 | 61 |       root = tix.Tk() | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 62 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 63 | To use :mod:`tkinter.tix`, you must have the Tix widgets installed, usually | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 64 | alongside your installation of the Tk widgets. To test your installation, try | 
 | 65 | the following:: | 
 | 66 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 67 |    from tkinter import tix | 
 | 68 |    root = tix.Tk() | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 69 |    root.tk.eval('package require Tix') | 
 | 70 |  | 
 | 71 | If this fails, you have a Tk installation problem which must be resolved before | 
 | 72 | proceeding. Use the environment variable :envvar:`TIX_LIBRARY` to point to the | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 73 | installed Tix library directory, and make sure you have the dynamic | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 74 | object library (:file:`tix8183.dll` or :file:`libtix8183.so`) in  the same | 
 | 75 | directory that contains your Tk dynamic object library (:file:`tk8183.dll` or | 
 | 76 | :file:`libtk8183.so`). The directory with the dynamic object library should also | 
 | 77 | have a file called :file:`pkgIndex.tcl` (case sensitive), which contains the | 
 | 78 | line:: | 
 | 79 |  | 
 | 80 |    package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix] | 
 | 81 |  | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 82 |  | 
 | 83 | Tix Widgets | 
 | 84 | ----------- | 
 | 85 |  | 
 | 86 | `Tix <http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm>`_ | 
| Georg Brandl | 59b4472 | 2010-12-30 22:12:40 +0000 | [diff] [blame] | 87 | introduces over 40 widget classes to the :mod:`tkinter` repertoire. | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 88 |  | 
 | 89 |  | 
 | 90 | Basic Widgets | 
 | 91 | ^^^^^^^^^^^^^ | 
 | 92 |  | 
 | 93 |  | 
 | 94 | .. class:: Balloon() | 
 | 95 |  | 
 | 96 |    A `Balloon | 
 | 97 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixBalloon.htm>`_ that | 
 | 98 |    pops up over a widget to provide help.  When the user moves the cursor inside a | 
 | 99 |    widget to which a Balloon widget has been bound, a small pop-up window with a | 
 | 100 |    descriptive message will be shown on the screen. | 
 | 101 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 102 | .. Python Demo of: | 
 | 103 | .. \ulink{Balloon}{http://tix.sourceforge.net/dist/current/demos/samples/Balloon.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 104 |  | 
 | 105 |  | 
 | 106 | .. class:: ButtonBox() | 
 | 107 |  | 
 | 108 |    The `ButtonBox | 
 | 109 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixButtonBox.htm>`_ | 
 | 110 |    widget creates a box of buttons, such as is commonly used for ``Ok Cancel``. | 
 | 111 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 112 | .. Python Demo of: | 
 | 113 | .. \ulink{ButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/BtnBox.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 114 |  | 
 | 115 |  | 
 | 116 | .. class:: ComboBox() | 
 | 117 |  | 
 | 118 |    The `ComboBox | 
 | 119 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixComboBox.htm>`_ | 
 | 120 |    widget is similar to the combo box control in MS Windows. The user can select a | 
| Georg Brandl | 6faee4e | 2010-09-21 14:48:28 +0000 | [diff] [blame] | 121 |    choice by either typing in the entry subwidget or selecting from the listbox | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 122 |    subwidget. | 
 | 123 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 124 | .. Python Demo of: | 
 | 125 | .. \ulink{ComboBox}{http://tix.sourceforge.net/dist/current/demos/samples/ComboBox.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 126 |  | 
 | 127 |  | 
 | 128 | .. class:: Control() | 
 | 129 |  | 
 | 130 |    The `Control | 
 | 131 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixControl.htm>`_ | 
 | 132 |    widget is also known as the :class:`SpinBox` widget. The user can adjust the | 
 | 133 |    value by pressing the two arrow buttons or by entering the value directly into | 
 | 134 |    the entry. The new value will be checked against the user-defined upper and | 
 | 135 |    lower limits. | 
 | 136 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 137 | .. Python Demo of: | 
 | 138 | .. \ulink{Control}{http://tix.sourceforge.net/dist/current/demos/samples/Control.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 139 |  | 
 | 140 |  | 
 | 141 | .. class:: LabelEntry() | 
 | 142 |  | 
 | 143 |    The `LabelEntry | 
 | 144 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelEntry.htm>`_ | 
 | 145 |    widget packages an entry widget and a label into one mega widget. It can be used | 
 | 146 |    be used to simplify the creation of "entry-form" type of interface. | 
 | 147 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 148 | .. Python Demo of: | 
 | 149 | .. \ulink{LabelEntry}{http://tix.sourceforge.net/dist/current/demos/samples/LabEntry.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 150 |  | 
 | 151 |  | 
 | 152 | .. class:: LabelFrame() | 
 | 153 |  | 
 | 154 |    The `LabelFrame | 
 | 155 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelFrame.htm>`_ | 
 | 156 |    widget packages a frame widget and a label into one mega widget.  To create | 
 | 157 |    widgets inside a LabelFrame widget, one creates the new widgets relative to the | 
 | 158 |    :attr:`frame` subwidget and manage them inside the :attr:`frame` subwidget. | 
 | 159 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 160 | .. Python Demo of: | 
 | 161 | .. \ulink{LabelFrame}{http://tix.sourceforge.net/dist/current/demos/samples/LabFrame.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 162 |  | 
 | 163 |  | 
 | 164 | .. class:: Meter() | 
 | 165 |  | 
 | 166 |    The `Meter | 
 | 167 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixMeter.htm>`_ widget | 
 | 168 |    can be used to show the progress of a background job which may take a long time | 
 | 169 |    to execute. | 
 | 170 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 171 | .. Python Demo of: | 
 | 172 | .. \ulink{Meter}{http://tix.sourceforge.net/dist/current/demos/samples/Meter.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 173 |  | 
 | 174 |  | 
 | 175 | .. class:: OptionMenu() | 
 | 176 |  | 
 | 177 |    The `OptionMenu | 
 | 178 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixOptionMenu.htm>`_ | 
 | 179 |    creates a menu button of options. | 
 | 180 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 181 | .. Python Demo of: | 
 | 182 | .. \ulink{OptionMenu}{http://tix.sourceforge.net/dist/current/demos/samples/OptMenu.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 183 |  | 
 | 184 |  | 
 | 185 | .. class:: PopupMenu() | 
 | 186 |  | 
 | 187 |    The `PopupMenu | 
 | 188 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPopupMenu.htm>`_ | 
 | 189 |    widget can be used as a replacement of the ``tk_popup`` command. The advantage | 
 | 190 |    of the :mod:`Tix` :class:`PopupMenu` widget is it requires less application code | 
 | 191 |    to manipulate. | 
 | 192 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 193 | .. Python Demo of: | 
 | 194 | .. \ulink{PopupMenu}{http://tix.sourceforge.net/dist/current/demos/samples/PopMenu.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 195 |  | 
 | 196 |  | 
 | 197 | .. class:: Select() | 
 | 198 |  | 
 | 199 |    The `Select | 
 | 200 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixSelect.htm>`_ widget | 
 | 201 |    is a container of button subwidgets. It can be used to provide radio-box or | 
 | 202 |    check-box style of selection options for the user. | 
 | 203 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 204 | .. Python Demo of: | 
 | 205 | .. \ulink{Select}{http://tix.sourceforge.net/dist/current/demos/samples/Select.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 206 |  | 
 | 207 |  | 
 | 208 | .. class:: StdButtonBox() | 
 | 209 |  | 
 | 210 |    The `StdButtonBox | 
 | 211 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixStdButtonBox.htm>`_ | 
 | 212 |    widget is a group of standard buttons for Motif-like dialog boxes. | 
 | 213 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 214 | .. Python Demo of: | 
 | 215 | .. \ulink{StdButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/StdBBox.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 216 |  | 
 | 217 |  | 
 | 218 | File Selectors | 
 | 219 | ^^^^^^^^^^^^^^ | 
 | 220 |  | 
 | 221 |  | 
 | 222 | .. class:: DirList() | 
 | 223 |  | 
 | 224 |    The `DirList | 
 | 225 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirList.htm>`_ | 
 | 226 |    widget displays a list view of a directory, its previous directories and its | 
 | 227 |    sub-directories. The user can choose one of the directories displayed in the | 
 | 228 |    list or change to another directory. | 
 | 229 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 230 | .. Python Demo of: | 
 | 231 | .. \ulink{DirList}{http://tix.sourceforge.net/dist/current/demos/samples/DirList.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 232 |  | 
 | 233 |  | 
 | 234 | .. class:: DirTree() | 
 | 235 |  | 
 | 236 |    The `DirTree | 
 | 237 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirTree.htm>`_ | 
 | 238 |    widget displays a tree view of a directory, its previous directories and its | 
 | 239 |    sub-directories. The user can choose one of the directories displayed in the | 
 | 240 |    list or change to another directory. | 
 | 241 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 242 | .. Python Demo of: | 
 | 243 | .. \ulink{DirTree}{http://tix.sourceforge.net/dist/current/demos/samples/DirTree.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 244 |  | 
 | 245 |  | 
 | 246 | .. class:: DirSelectDialog() | 
 | 247 |  | 
 | 248 |    The `DirSelectDialog | 
 | 249 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirSelectDialog.htm>`_ | 
 | 250 |    widget presents the directories in the file system in a dialog window.  The user | 
 | 251 |    can use this dialog window to navigate through the file system to select the | 
 | 252 |    desired directory. | 
 | 253 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 254 | .. Python Demo of: | 
 | 255 | .. \ulink{DirSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/DirDlg.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 256 |  | 
 | 257 |  | 
 | 258 | .. class:: DirSelectBox() | 
 | 259 |  | 
 | 260 |    The :class:`DirSelectBox` is similar to the standard Motif(TM) | 
 | 261 |    directory-selection box. It is generally used for the user to choose a | 
 | 262 |    directory.  DirSelectBox stores the directories mostly recently selected into | 
 | 263 |    a ComboBox widget so that they can be quickly selected again. | 
 | 264 |  | 
 | 265 |  | 
 | 266 | .. class:: ExFileSelectBox() | 
 | 267 |  | 
 | 268 |    The `ExFileSelectBox | 
 | 269 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm>`_ | 
 | 270 |    widget is usually embedded in a tixExFileSelectDialog widget. It provides an | 
 | 271 |    convenient method for the user to select files. The style of the | 
 | 272 |    :class:`ExFileSelectBox` widget is very similar to the standard file dialog on | 
 | 273 |    MS Windows 3.1. | 
 | 274 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 275 | .. Python Demo of: | 
 | 276 | .. \ulink{ExFileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/EFileDlg.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 277 |  | 
 | 278 |  | 
 | 279 | .. class:: FileSelectBox() | 
 | 280 |  | 
 | 281 |    The `FileSelectBox | 
 | 282 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileSelectBox.htm>`_ | 
 | 283 |    is similar to the standard Motif(TM) file-selection box. It is generally used | 
 | 284 |    for the user to choose a file. FileSelectBox stores the files mostly recently | 
 | 285 |    selected into a :class:`ComboBox` widget so that they can be quickly selected | 
 | 286 |    again. | 
 | 287 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 288 | .. Python Demo of: | 
 | 289 | .. \ulink{FileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/FileDlg.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 290 |  | 
 | 291 |  | 
 | 292 | .. class:: FileEntry() | 
 | 293 |  | 
 | 294 |    The `FileEntry | 
 | 295 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileEntry.htm>`_ | 
 | 296 |    widget can be used to input a filename. The user can type in the filename | 
 | 297 |    manually. Alternatively, the user can press the button widget that sits next to | 
 | 298 |    the entry, which will bring up a file selection dialog. | 
 | 299 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 300 | .. Python Demo of: | 
 | 301 | .. \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 302 |  | 
 | 303 |  | 
| Georg Brandl | 2ee470f | 2008-07-16 12:55:28 +0000 | [diff] [blame] | 304 | Hierarchical ListBox | 
 | 305 | ^^^^^^^^^^^^^^^^^^^^ | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 306 |  | 
 | 307 |  | 
 | 308 | .. class:: HList() | 
 | 309 |  | 
 | 310 |    The `HList | 
 | 311 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixHList.htm>`_ widget | 
 | 312 |    can be used to display any data that have a hierarchical structure, for example, | 
 | 313 |    file system directory trees. The list entries are indented and connected by | 
 | 314 |    branch lines according to their places in the hierarchy. | 
 | 315 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 316 | .. Python Demo of: | 
 | 317 | .. \ulink{HList}{http://tix.sourceforge.net/dist/current/demos/samples/HList1.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 318 |  | 
 | 319 |  | 
 | 320 | .. class:: CheckList() | 
 | 321 |  | 
 | 322 |    The `CheckList | 
 | 323 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixCheckList.htm>`_ | 
 | 324 |    widget displays a list of items to be selected by the user. CheckList acts | 
 | 325 |    similarly to the Tk checkbutton or radiobutton widgets, except it is capable of | 
 | 326 |    handling many more items than checkbuttons or radiobuttons. | 
 | 327 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 328 | .. Python Demo of: | 
 | 329 | .. \ulink{ CheckList}{http://tix.sourceforge.net/dist/current/demos/samples/ChkList.tcl} | 
 | 330 | .. Python Demo of: | 
 | 331 | .. \ulink{ScrolledHList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList.tcl} | 
 | 332 | .. Python Demo of: | 
 | 333 | .. \ulink{ScrolledHList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/SHList2.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 334 |  | 
 | 335 |  | 
 | 336 | .. class:: Tree() | 
 | 337 |  | 
 | 338 |    The `Tree | 
 | 339 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTree.htm>`_ widget | 
 | 340 |    can be used to display hierarchical data in a tree form. The user can adjust the | 
 | 341 |    view of the tree by opening or closing parts of the tree. | 
 | 342 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 343 | .. Python Demo of: | 
 | 344 | .. \ulink{Tree}{http://tix.sourceforge.net/dist/current/demos/samples/Tree.tcl} | 
 | 345 | .. Python Demo of: | 
 | 346 | .. \ulink{Tree (Dynamic)}{http://tix.sourceforge.net/dist/current/demos/samples/DynTree.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 347 |  | 
 | 348 |  | 
 | 349 | Tabular ListBox | 
 | 350 | ^^^^^^^^^^^^^^^ | 
 | 351 |  | 
 | 352 |  | 
 | 353 | .. class:: TList() | 
 | 354 |  | 
 | 355 |    The `TList | 
 | 356 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTList.htm>`_ widget | 
 | 357 |    can be used to display data in a tabular format. The list entries of a | 
 | 358 |    :class:`TList` widget are similar to the entries in the Tk listbox widget.  The | 
 | 359 |    main differences are (1) the :class:`TList` widget can display the list entries | 
 | 360 |    in a two dimensional format and (2) you can use graphical images as well as | 
 | 361 |    multiple colors and fonts for the list entries. | 
 | 362 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 363 | .. Python Demo of: | 
 | 364 | .. \ulink{ScrolledTList (1)}{http://tix.sourceforge.net/dist/current/demos/samples/STList1.tcl} | 
 | 365 | .. Python Demo of: | 
 | 366 | .. \ulink{ScrolledTList (2)}{http://tix.sourceforge.net/dist/current/demos/samples/STList2.tcl} | 
 | 367 | .. Grid has yet to be added to Python | 
 | 368 | .. \subsubsection{Grid Widget} | 
 | 369 | .. Python Demo of: | 
 | 370 | .. \ulink{Simple Grid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid0.tcl} | 
 | 371 | .. Python Demo of: | 
 | 372 | .. \ulink{ScrolledGrid}{http://tix.sourceforge.net/dist/current/demos/samples/SGrid1.tcl} | 
 | 373 | .. Python Demo of: | 
 | 374 | .. \ulink{Editable Grid}{http://tix.sourceforge.net/dist/current/demos/samples/EditGrid.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 375 |  | 
 | 376 |  | 
 | 377 | Manager Widgets | 
 | 378 | ^^^^^^^^^^^^^^^ | 
 | 379 |  | 
 | 380 |  | 
 | 381 | .. class:: PanedWindow() | 
 | 382 |  | 
 | 383 |    The `PanedWindow | 
 | 384 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPanedWindow.htm>`_ | 
 | 385 |    widget allows the user to interactively manipulate the sizes of several panes. | 
 | 386 |    The panes can be arranged either vertically or horizontally.  The user changes | 
 | 387 |    the sizes of the panes by dragging the resize handle between two panes. | 
 | 388 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 389 | .. Python Demo of: | 
 | 390 | .. \ulink{PanedWindow}{http://tix.sourceforge.net/dist/current/demos/samples/PanedWin.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 391 |  | 
 | 392 |  | 
 | 393 | .. class:: ListNoteBook() | 
 | 394 |  | 
 | 395 |    The `ListNoteBook | 
 | 396 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixListNoteBook.htm>`_ | 
 | 397 |    widget is very similar to the :class:`TixNoteBook` widget: it can be used to | 
 | 398 |    display many windows in a limited space using a notebook metaphor. The notebook | 
 | 399 |    is divided into a stack of pages (windows). At one time only one of these pages | 
 | 400 |    can be shown. The user can navigate through these pages by choosing the name of | 
 | 401 |    the desired page in the :attr:`hlist` subwidget. | 
 | 402 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 403 | .. Python Demo of: | 
 | 404 | .. \ulink{ListNoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/ListNBK.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 405 |  | 
 | 406 |  | 
 | 407 | .. class:: NoteBook() | 
 | 408 |  | 
 | 409 |    The `NoteBook | 
 | 410 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixNoteBook.htm>`_ | 
 | 411 |    widget can be used to display many windows in a limited space using a notebook | 
 | 412 |    metaphor. The notebook is divided into a stack of pages. At one time only one of | 
 | 413 |    these pages can be shown. The user can navigate through these pages by choosing | 
 | 414 |    the visual "tabs" at the top of the NoteBook widget. | 
 | 415 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 416 | .. Python Demo of: | 
 | 417 | .. \ulink{NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/NoteBook.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 418 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 419 | .. \subsubsection{Scrolled Widgets} | 
 | 420 | .. Python Demo of: | 
 | 421 | .. \ulink{ScrolledListBox}{http://tix.sourceforge.net/dist/current/demos/samples/SListBox.tcl} | 
 | 422 | .. Python Demo of: | 
 | 423 | .. \ulink{ScrolledText}{http://tix.sourceforge.net/dist/current/demos/samples/SText.tcl} | 
 | 424 | .. Python Demo of: | 
 | 425 | .. \ulink{ScrolledWindow}{http://tix.sourceforge.net/dist/current/demos/samples/SWindow.tcl} | 
 | 426 | .. Python Demo of: | 
 | 427 | .. \ulink{Canvas Object View}{http://tix.sourceforge.net/dist/current/demos/samples/CObjView.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 428 |  | 
 | 429 |  | 
 | 430 | Image Types | 
 | 431 | ^^^^^^^^^^^ | 
 | 432 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 433 | The :mod:`tkinter.tix` module adds: | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 434 |  | 
 | 435 | * `pixmap <http://tix.sourceforge.net/dist/current/man/html/TixCmd/pixmap.htm>`_ | 
| Georg Brandl | 48310cd | 2009-01-03 21:18:54 +0000 | [diff] [blame] | 436 |   capabilities to all :mod:`tkinter.tix` and :mod:`tkinter` widgets to create | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 437 |   color images from XPM files. | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 438 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 439 |   .. Python Demo of: | 
 | 440 |   .. \ulink{XPM Image In Button}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm.tcl} | 
 | 441 |   .. Python Demo of: | 
 | 442 |   .. \ulink{XPM Image In Menu}{http://tix.sourceforge.net/dist/current/demos/samples/Xpm1.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 443 |  | 
 | 444 | * `Compound | 
 | 445 |   <http://tix.sourceforge.net/dist/current/man/html/TixCmd/compound.htm>`_ image | 
 | 446 |   types can be used to create images that consists of multiple horizontal lines; | 
 | 447 |   each line is composed of a series of items (texts, bitmaps, images or spaces) | 
 | 448 |   arranged from left to right. For example, a compound image can be used to | 
 | 449 |   display a bitmap and a text string simultaneously in a Tk :class:`Button` | 
 | 450 |   widget. | 
 | 451 |  | 
| Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 452 |   .. Python Demo of: | 
 | 453 |   .. \ulink{Compound Image In Buttons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg.tcl} | 
 | 454 |   .. Python Demo of: | 
 | 455 |   .. \ulink{Compound Image In NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg2.tcl} | 
 | 456 |   .. Python Demo of: | 
 | 457 |   .. \ulink{Compound Image Notebook Color Tabs}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg4.tcl} | 
 | 458 |   .. Python Demo of: | 
 | 459 |   .. \ulink{Compound Image Icons}{http://tix.sourceforge.net/dist/current/demos/samples/CmpImg3.tcl} | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 460 |  | 
 | 461 |  | 
 | 462 | Miscellaneous Widgets | 
 | 463 | ^^^^^^^^^^^^^^^^^^^^^ | 
 | 464 |  | 
 | 465 |  | 
 | 466 | .. class:: InputOnly() | 
 | 467 |  | 
 | 468 |    The `InputOnly | 
 | 469 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixInputOnly.htm>`_ | 
 | 470 |    widgets are to accept inputs from the user, which can be done with the ``bind`` | 
 | 471 |    command (Unix only). | 
 | 472 |  | 
 | 473 |  | 
 | 474 | Form Geometry Manager | 
 | 475 | ^^^^^^^^^^^^^^^^^^^^^ | 
 | 476 |  | 
| Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 477 | In addition, :mod:`tkinter.tix` augments :mod:`tkinter` by providing: | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 478 |  | 
 | 479 |  | 
 | 480 | .. class:: Form() | 
 | 481 |  | 
 | 482 |    The `Form | 
 | 483 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm>`_ geometry | 
 | 484 |    manager based on attachment rules for all Tk widgets. | 
 | 485 |  | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 486 |  | 
 | 487 | Tix Commands | 
 | 488 | ------------ | 
 | 489 |  | 
 | 490 |  | 
 | 491 | .. class:: tixCommand() | 
 | 492 |  | 
 | 493 |    The `tix commands | 
 | 494 |    <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tix.htm>`_ provide | 
 | 495 |    access to miscellaneous elements of :mod:`Tix`'s internal state and the | 
 | 496 |    :mod:`Tix` application context.  Most of the information manipulated by these | 
 | 497 |    methods pertains to the application as a whole, or to a screen or display, | 
 | 498 |    rather than to a particular window. | 
 | 499 |  | 
 | 500 |    To view the current settings, the common usage is:: | 
 | 501 |  | 
| Terry Reedy | 2a6ac15 | 2011-01-24 20:48:40 +0000 | [diff] [blame] | 502 |       from tkinter import tix | 
 | 503 |       root = tix.Tk() | 
| Collin Winter | c79461b | 2007-09-01 23:34:30 +0000 | [diff] [blame] | 504 |       print(root.tix_configure()) | 
| Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 505 |  | 
 | 506 |  | 
 | 507 | .. method:: tixCommand.tix_configure([cnf,] **kw) | 
 | 508 |  | 
 | 509 |    Query or modify the configuration options of the Tix application context. If no | 
 | 510 |    option is specified, returns a dictionary all of the available options.  If | 
 | 511 |    option is specified with no value, then the method returns a list describing the | 
 | 512 |    one named option (this list will be identical to the corresponding sublist of | 
 | 513 |    the value returned if no option is specified).  If one or more option-value | 
 | 514 |    pairs are specified, then the method modifies the given option(s) to have the | 
 | 515 |    given value(s); in this case the method returns an empty string. Option may be | 
 | 516 |    any of the configuration options. | 
 | 517 |  | 
 | 518 |  | 
 | 519 | .. method:: tixCommand.tix_cget(option) | 
 | 520 |  | 
 | 521 |    Returns the current value of the configuration option given by *option*. Option | 
 | 522 |    may be any of the configuration options. | 
 | 523 |  | 
 | 524 |  | 
 | 525 | .. method:: tixCommand.tix_getbitmap(name) | 
 | 526 |  | 
 | 527 |    Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the bitmap | 
 | 528 |    directories (see the :meth:`tix_addbitmapdir` method).  By using | 
 | 529 |    :meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap | 
 | 530 |    files in your application. When successful, it returns the complete pathname of | 
 | 531 |    the bitmap file, prefixed with the character ``@``.  The returned value can be | 
 | 532 |    used to configure the ``bitmap`` option of the Tk and Tix widgets. | 
 | 533 |  | 
 | 534 |  | 
 | 535 | .. method:: tixCommand.tix_addbitmapdir(directory) | 
 | 536 |  | 
 | 537 |    Tix maintains a list of directories under which the :meth:`tix_getimage` and | 
 | 538 |    :meth:`tix_getbitmap` methods will search for image files.  The standard bitmap | 
 | 539 |    directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:`tix_addbitmapdir` method | 
 | 540 |    adds *directory* into this list. By using this method, the image files of an | 
 | 541 |    applications can also be located using the :meth:`tix_getimage` or | 
 | 542 |    :meth:`tix_getbitmap` method. | 
 | 543 |  | 
 | 544 |  | 
 | 545 | .. method:: tixCommand.tix_filedialog([dlgclass]) | 
 | 546 |  | 
 | 547 |    Returns the file selection dialog that may be shared among different calls from | 
 | 548 |    this application.  This method will create a file selection dialog widget when | 
 | 549 |    it is called the first time. This dialog will be returned by all subsequent | 
 | 550 |    calls to :meth:`tix_filedialog`.  An optional dlgclass parameter can be passed | 
 | 551 |    as a string to specified what type of file selection dialog widget is desired. | 
 | 552 |    Possible options are ``tix``, ``FileSelectDialog`` or ``tixExFileSelectDialog``. | 
 | 553 |  | 
 | 554 |  | 
 | 555 | .. method:: tixCommand.tix_getimage(self, name) | 
 | 556 |  | 
 | 557 |    Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or | 
 | 558 |    :file:`name.ppm` in one of the bitmap directories (see the | 
 | 559 |    :meth:`tix_addbitmapdir` method above). If more than one file with the same name | 
 | 560 |    (but different extensions) exist, then the image type is chosen according to the | 
 | 561 |    depth of the X display: xbm images are chosen on monochrome displays and color | 
 | 562 |    images are chosen on color displays. By using :meth:`tix_getimage`, you can | 
 | 563 |    avoid hard coding the pathnames of the image files in your application. When | 
 | 564 |    successful, this method returns the name of the newly created image, which can | 
 | 565 |    be used to configure the ``image`` option of the Tk and Tix widgets. | 
 | 566 |  | 
 | 567 |  | 
 | 568 | .. method:: tixCommand.tix_option_get(name) | 
 | 569 |  | 
 | 570 |    Gets the options maintained by the Tix scheme mechanism. | 
 | 571 |  | 
 | 572 |  | 
 | 573 | .. method:: tixCommand.tix_resetoptions(newScheme, newFontSet[, newScmPrio]) | 
 | 574 |  | 
 | 575 |    Resets the scheme and fontset of the Tix application to *newScheme* and | 
 | 576 |    *newFontSet*, respectively.  This affects only those widgets created after this | 
 | 577 |    call.  Therefore, it is best to call the resetoptions method before the creation | 
 | 578 |    of any widgets in a Tix application. | 
 | 579 |  | 
 | 580 |    The optional parameter *newScmPrio* can be given to reset the priority level of | 
 | 581 |    the Tk options set by the Tix schemes. | 
 | 582 |  | 
 | 583 |    Because of the way Tk handles the X option database, after Tix has been has | 
 | 584 |    imported and inited, it is not possible to reset the color schemes and font sets | 
 | 585 |    using the :meth:`tix_config` method. Instead, the :meth:`tix_resetoptions` | 
 | 586 |    method must be used. |