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