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