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