blob: ff2cfff5055c7938cdd9986b02aab306a888c00b [file] [log] [blame]
Georg Brandl8ec7f652007-08-15 14:28:01 +00001:mod:`Tix` --- Extension widgets for Tk
2=======================================
3
4.. module:: Tix
5 :synopsis: Tk Extension Widgets for Tkinter
6.. sectionauthor:: Mike Clarkson <mikeclarkson@users.sourceforge.net>
7
8
9.. index:: single: Tix
10
11The :mod:`Tix` (Tk Interface Extension) module provides an additional rich set
12of widgets. Although the standard Tk library has many useful widgets, they are
13far from complete. The :mod:`Tix` library provides most of the commonly needed
14widgets that are missing from standard Tk: :class:`HList`, :class:`ComboBox`,
15:class:`Control` (a.k.a. SpinBox) and an assortment of scrollable widgets.
16:mod:`Tix` also includes many more widgets that are generally useful in a wide
17range of applications: :class:`NoteBook`, :class:`FileEntry`,
18:class:`PanedWindow`, etc; there are more than 40 of them.
19
20With all these new widgets, you can introduce new interaction techniques into
21applications, creating more useful and more intuitive user interfaces. You can
22design your application by choosing the most appropriate widgets to match the
23special needs of your application and users.
24
25
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
Georg Brandl02677812008-03-15 00:20:19 +000038 `Tix Development Applications <http://tix.sourceforge.net/Tixapps/src/Tide.html>`_
Georg Brandl8ec7f652007-08-15 14:28:01 +000039 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
44Using Tix
45---------
46
47
48.. class:: Tix(screenName[, baseName[, className]])
49
50 Toplevel widget of Tix which represents mostly the main window of an
51 application. It has an associated Tcl interpreter.
52
53 Classes in the :mod:`Tix` module subclasses the classes in the :mod:`Tkinter`
54 module. The former imports the latter, so to use :mod:`Tix` with Tkinter, all
55 you need to do is to import one module. In general, you can just import
56 :mod:`Tix`, and replace the toplevel call to :class:`Tkinter.Tk` with
57 :class:`Tix.Tk`::
58
59 import Tix
60 from Tkconstants import *
61 root = Tix.Tk()
62
63To use :mod:`Tix`, you must have the :mod:`Tix` widgets installed, usually
64alongside your installation of the Tk widgets. To test your installation, try
65the following::
66
67 import Tix
68 root = Tix.Tk()
69 root.tk.eval('package require Tix')
70
71If this fails, you have a Tk installation problem which must be resolved before
72proceeding. Use the environment variable :envvar:`TIX_LIBRARY` to point to the
73installed :mod:`Tix` library directory, and make sure you have the dynamic
74object library (:file:`tix8183.dll` or :file:`libtix8183.so`) in the same
75directory that contains your Tk dynamic object library (:file:`tk8183.dll` or
76:file:`libtk8183.so`). The directory with the dynamic object library should also
77have a file called :file:`pkgIndex.tcl` (case sensitive), which contains the
78line::
79
80 package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]
81
Georg Brandl8ec7f652007-08-15 14:28:01 +000082
83Tix Widgets
84-----------
85
86`Tix <http://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm>`_
87introduces over 40 widget classes to the :mod:`Tkinter` repertoire. There is a
88demo of all the :mod:`Tix` widgets in the :file:`Demo/tix` directory of the
89standard distribution.
90
Georg Brandlb19be572007-12-29 10:57:00 +000091.. The Python sample code is still being added to Python, hence commented out
Georg Brandl8ec7f652007-08-15 14:28:01 +000092
93
94Basic 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
Georg Brandlb19be572007-12-29 10:57:00 +0000106.. Python Demo of:
107.. \ulink{Balloon}{http://tix.sourceforge.net/dist/current/demos/samples/Balloon.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000108
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
Georg Brandlb19be572007-12-29 10:57:00 +0000116.. Python Demo of:
117.. \ulink{ButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/BtnBox.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000118
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
Georg Brandlb19be572007-12-29 10:57:00 +0000128.. Python Demo of:
129.. \ulink{ComboBox}{http://tix.sourceforge.net/dist/current/demos/samples/ComboBox.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000130
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
Georg Brandlb19be572007-12-29 10:57:00 +0000141.. Python Demo of:
142.. \ulink{Control}{http://tix.sourceforge.net/dist/current/demos/samples/Control.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000143
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
Georg Brandlb19be572007-12-29 10:57:00 +0000152.. Python Demo of:
153.. \ulink{LabelEntry}{http://tix.sourceforge.net/dist/current/demos/samples/LabEntry.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000154
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
Georg Brandlb19be572007-12-29 10:57:00 +0000164.. Python Demo of:
165.. \ulink{LabelFrame}{http://tix.sourceforge.net/dist/current/demos/samples/LabFrame.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000166
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
Georg Brandlb19be572007-12-29 10:57:00 +0000175.. Python Demo of:
176.. \ulink{Meter}{http://tix.sourceforge.net/dist/current/demos/samples/Meter.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000177
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
Georg Brandlb19be572007-12-29 10:57:00 +0000185.. Python Demo of:
186.. \ulink{OptionMenu}{http://tix.sourceforge.net/dist/current/demos/samples/OptMenu.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000187
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
Georg Brandlb19be572007-12-29 10:57:00 +0000197.. Python Demo of:
198.. \ulink{PopupMenu}{http://tix.sourceforge.net/dist/current/demos/samples/PopMenu.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000199
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
Georg Brandlb19be572007-12-29 10:57:00 +0000208.. Python Demo of:
209.. \ulink{Select}{http://tix.sourceforge.net/dist/current/demos/samples/Select.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000210
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
Georg Brandlb19be572007-12-29 10:57:00 +0000218.. Python Demo of:
219.. \ulink{StdButtonBox}{http://tix.sourceforge.net/dist/current/demos/samples/StdBBox.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000220
221
222File 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
Georg Brandlb19be572007-12-29 10:57:00 +0000234.. Python Demo of:
235.. \ulink{DirList}{http://tix.sourceforge.net/dist/current/demos/samples/DirList.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000236
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
Georg Brandlb19be572007-12-29 10:57:00 +0000246.. Python Demo of:
247.. \ulink{DirTree}{http://tix.sourceforge.net/dist/current/demos/samples/DirTree.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000248
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
Georg Brandlb19be572007-12-29 10:57:00 +0000258.. Python Demo of:
259.. \ulink{DirSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/DirDlg.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000260
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
Georg Brandlb19be572007-12-29 10:57:00 +0000279.. Python Demo of:
280.. \ulink{ExFileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/EFileDlg.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000281
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
Georg Brandlb19be572007-12-29 10:57:00 +0000292.. Python Demo of:
293.. \ulink{FileSelectDialog}{http://tix.sourceforge.net/dist/current/demos/samples/FileDlg.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000294
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
Georg Brandlb19be572007-12-29 10:57:00 +0000304.. Python Demo of:
305.. \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000306
307
308Hierachical ListBox
309^^^^^^^^^^^^^^^^^^^
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
Georg Brandlb19be572007-12-29 10:57:00 +0000320.. Python Demo of:
321.. \ulink{HList}{http://tix.sourceforge.net/dist/current/demos/samples/HList1.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000322
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
Georg Brandlb19be572007-12-29 10:57:00 +0000332.. 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 Brandl8ec7f652007-08-15 14:28:01 +0000338
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
Georg Brandlb19be572007-12-29 10:57:00 +0000347.. 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 Brandl8ec7f652007-08-15 14:28:01 +0000351
352
353Tabular 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
Georg Brandlb19be572007-12-29 10:57:00 +0000367.. 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 Brandl8ec7f652007-08-15 14:28:01 +0000379
380
381Manager 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
Georg Brandlb19be572007-12-29 10:57:00 +0000393.. Python Demo of:
394.. \ulink{PanedWindow}{http://tix.sourceforge.net/dist/current/demos/samples/PanedWin.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000395
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
Georg Brandlb19be572007-12-29 10:57:00 +0000407.. Python Demo of:
408.. \ulink{ListNoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/ListNBK.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000409
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
Georg Brandlb19be572007-12-29 10:57:00 +0000420.. Python Demo of:
421.. \ulink{NoteBook}{http://tix.sourceforge.net/dist/current/demos/samples/NoteBook.tcl}
Georg Brandl8ec7f652007-08-15 14:28:01 +0000422
Georg Brandlb19be572007-12-29 10:57:00 +0000423.. \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 Brandl8ec7f652007-08-15 14:28:01 +0000432
433
434Image Types
435^^^^^^^^^^^
436
437The :mod:`Tix` module adds:
438
439* `pixmap <http://tix.sourceforge.net/dist/current/man/html/TixCmd/pixmap.htm>`_
440 capabilities to all :mod:`Tix` and :mod:`Tkinter` widgets to create color images
441 from XPM files.
442
Georg Brandlb19be572007-12-29 10:57:00 +0000443 .. 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 Brandl8ec7f652007-08-15 14:28:01 +0000447
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
Georg Brandlb19be572007-12-29 10:57:00 +0000456 .. 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 Brandl8ec7f652007-08-15 14:28:01 +0000464
465
466Miscellaneous 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
478Form Geometry Manager
479^^^^^^^^^^^^^^^^^^^^^
480
481In addition, :mod:`Tix` augments :mod:`Tkinter` by providing:
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 Brandl8ec7f652007-08-15 14:28:01 +0000490
491
492Tix Commands
493------------
494
495
496.. class:: tixCommand()
497
498 The `tix commands
499 <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tix.htm>`_ provide
500 access to miscellaneous elements of :mod:`Tix`'s internal state and the
501 :mod:`Tix` application context. Most of the information manipulated by these
502 methods pertains to the application as a whole, or to a screen or display,
503 rather than to a particular window.
504
505 To view the current settings, the common usage is::
506
507 import Tix
508 root = Tix.Tk()
509 print root.tix_configure()
510
511
512.. method:: tixCommand.tix_configure([cnf,] **kw)
513
514 Query or modify the configuration options of the Tix application context. If no
515 option is specified, returns a dictionary all of the available options. If
516 option is specified with no value, then the method returns a list describing the
517 one named option (this list will be identical to the corresponding sublist of
518 the value returned if no option is specified). If one or more option-value
519 pairs are specified, then the method modifies the given option(s) to have the
520 given value(s); in this case the method returns an empty string. Option may be
521 any of the configuration options.
522
523
524.. method:: tixCommand.tix_cget(option)
525
526 Returns the current value of the configuration option given by *option*. Option
527 may be any of the configuration options.
528
529
530.. method:: tixCommand.tix_getbitmap(name)
531
532 Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the bitmap
533 directories (see the :meth:`tix_addbitmapdir` method). By using
534 :meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap
535 files in your application. When successful, it returns the complete pathname of
536 the bitmap file, prefixed with the character ``@``. The returned value can be
537 used to configure the ``bitmap`` option of the Tk and Tix widgets.
538
539
540.. method:: tixCommand.tix_addbitmapdir(directory)
541
542 Tix maintains a list of directories under which the :meth:`tix_getimage` and
543 :meth:`tix_getbitmap` methods will search for image files. The standard bitmap
544 directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:`tix_addbitmapdir` method
545 adds *directory* into this list. By using this method, the image files of an
546 applications can also be located using the :meth:`tix_getimage` or
547 :meth:`tix_getbitmap` method.
548
549
550.. method:: tixCommand.tix_filedialog([dlgclass])
551
552 Returns the file selection dialog that may be shared among different calls from
553 this application. This method will create a file selection dialog widget when
554 it is called the first time. This dialog will be returned by all subsequent
555 calls to :meth:`tix_filedialog`. An optional dlgclass parameter can be passed
556 as a string to specified what type of file selection dialog widget is desired.
557 Possible options are ``tix``, ``FileSelectDialog`` or ``tixExFileSelectDialog``.
558
559
560.. method:: tixCommand.tix_getimage(self, name)
561
562 Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or
563 :file:`name.ppm` in one of the bitmap directories (see the
564 :meth:`tix_addbitmapdir` method above). If more than one file with the same name
565 (but different extensions) exist, then the image type is chosen according to the
566 depth of the X display: xbm images are chosen on monochrome displays and color
567 images are chosen on color displays. By using :meth:`tix_getimage`, you can
568 avoid hard coding the pathnames of the image files in your application. When
569 successful, this method returns the name of the newly created image, which can
570 be used to configure the ``image`` option of the Tk and Tix widgets.
571
572
573.. method:: tixCommand.tix_option_get(name)
574
575 Gets the options maintained by the Tix scheme mechanism.
576
577
578.. method:: tixCommand.tix_resetoptions(newScheme, newFontSet[, newScmPrio])
579
580 Resets the scheme and fontset of the Tix application to *newScheme* and
581 *newFontSet*, respectively. This affects only those widgets created after this
582 call. Therefore, it is best to call the resetoptions method before the creation
583 of any widgets in a Tix application.
584
585 The optional parameter *newScmPrio* can be given to reset the priority level of
586 the Tk options set by the Tix schemes.
587
588 Because of the way Tk handles the X option database, after Tix has been has
589 imported and inited, it is not possible to reset the color schemes and font sets
590 using the :meth:`tix_config` method. Instead, the :meth:`tix_resetoptions`
591 method must be used.