blob: 5f67a72cd2557d3e8d88e059267c1030b2ca54da [file] [log] [blame]
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00002#
3# $Id$
4#
Martin v. Löwisb7b32602001-11-02 23:48:20 +00005# Tix.py -- Tix widget wrappers.
6#
7# For Tix, see http://tix.sourceforge.net
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00008#
Moshe Zadka22710822001-03-21 17:24:49 +00009# - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995.
Martin v. Löwisb7b32602001-11-02 23:48:20 +000010# based on an idea of Jean-Marc Lugrin (lugrin@ms.com)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +000011#
12# NOTE: In order to minimize changes to Tkinter.py, some of the code here
Moshe Zadka22710822001-03-21 17:24:49 +000013# (TixWidget.__init__) has been taken from Tkinter (Widget.__init__)
14# and will break if there are major changes in Tkinter.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +000015#
16# The Tix widgets are represented by a class hierarchy in python with proper
17# inheritance of base classes.
18#
19# As a result after creating a 'w = StdButtonBox', I can write
Moshe Zadka22710822001-03-21 17:24:49 +000020# w.ok['text'] = 'Who Cares'
21# or w.ok['bg'] = w['bg']
22# or even w.ok.invoke()
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +000023# etc.
24#
25# Compare the demo tixwidgets.py to the original Tcl program and you will
26# appreciate the advantages.
27#
28
29import string
30from Tkinter import *
31from Tkinter import _flatten, _cnfmerge, _default_root
32
33# WARNING - TkVersion is a limited precision floating point number
34if TkVersion < 3.999:
35 raise ImportError, "This version of Tix.py requires Tk 4.0 or higher"
36
37import _tkinter # If this fails your Python may not be configured for Tk
38# TixVersion = string.atof(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix
39# WARNING - TixVersion is a limited precision floating point number
40
41# Some more constants (for consistency with Tkinter)
42WINDOW = 'window'
43TEXT = 'text'
44STATUS = 'status'
45IMMEDIATE = 'immediate'
46IMAGE = 'image'
47IMAGETEXT = 'imagetext'
48BALLOON = 'balloon'
49AUTO = 'auto'
50ACROSSTOP = 'acrosstop'
51
52# BEWARE - this is implemented by copying some code from the Widget class
53# in Tkinter (to override Widget initialization) and is therefore
54# liable to break.
55import Tkinter, os
Martin v. Löwisb7b32602001-11-02 23:48:20 +000056
57# Could probably add this to Tkinter.Misc
58class tixCommand:
59 """The tix command provides access to miscellaneous elements
60 of Tix's internal state and the Tix application context.
61 Most of the information manipulated by this command per
62 tains to the application as a whole, or to a screen or
63 display, rather than to a particular window. The command
64 can take any of a number of different forms depending on
65 the option argument.
66
67 This is a mixin class, assumed to be mixed to Tkinter.Tk
68 that supports the self.tk.call method.
69 """
70 def tix_addbitmapdir(self, directory):
71 """Tix maintains a list of directory under which which
72 the tix_getimage and tix_getbitmap commands will
73 search for image files. The standard bitmap direc
74 tory is $TIX_LIBRARY/bitmaps. The addbitmapdir com
75 mand adds directory into this list. By using this
76 command, the image files of an applications can
77 also be located using the tix_getimage or tix_getbitmap
78 command.
79 """
80 return self.tk.call('tix', 'addbitmapdir', directory)
81
82 def tix_cget(self, option):
83 """Returns the current value of the configuration
84 option given by option. Option may be any of the
85 options described in the CONFIGURATION OPTIONS section.
86 """
87 return self.tk.call('tix', 'cget', option)
88
89 def tix_configure(self, cnf=None, **kw):
90 """Query or modify the configuration options of the
91 Tix application context. If no option is specified,
92 returns a list describing all of the available
93 options (see Tk_ConfigureInfo for information on
94 the format of this list). If option is specified
95 with no value, then the command returns a list
96 describing the one named option (this list will be
97 identical to the corresponding sublist of the value
98 returned if no option is specified). If one or
99 more option-value pairs are specified, then the
100 command modifies the given option(s) to have the
101 given value(s); in this case the command returns an
102 empty string. Option may be any of the options
103 described in the CONFIGURATION OPTIONS section.
104 """
105 return apply(self.tk.call, ('tix', configure) +
106 self._options(cnf,kw) )
107
108 def tix_filedialog(self, dlgclass=None):
109 """Returns the file selection dialog that may be
110 shared among different modules of this application.
111 This command will create a file selection dialog
112 widget when it is called the first time. This dialog
113 will be returned by all subsequent calls to tix
114 filedialog. An optional dlgclass parameter can be
115 passed to specified what type of file selection
116 dialog widget is desired. Possible options are 'tix'
117 'FileSelectDialog' or 'tixExFileSelectDialog'.
118 """
119 if dlgclass is not None:
120 return self.tk.call('tix', 'filedialog', dlgclass)
121 else:
122 return self.tk.call('tix', 'filedialog')
123
124 def tix_getbitmap(self, name):
125 """Locates a bitmap file of the name name.xpm or name
126 in one of the bitmap directories (self, see the
127 tix_addbitmapdir command above). By using tix_getbitmap,
128 you can advoid hard coding the pathnames of
129 the bitmap files in your application. When successful,
130 it returns the complete pathname of the bitmap
131 file, prefixed with the character '@'. The returned
132 value can be used to configure the -bitmap option
133 of the TK and Tix widgets.
134 """
135 return self.tk.call('tix', 'getbitmap', name)
136
137 def tix_getimage(self, name):
138 """Locates an image file of the name name.xpm,
139 name.xbm or name.ppm in one of the bitmap directo
140 ries (see the addbitmapdir command above). If more
141 than one file with the same name (but different
142 extensions) exist, then the image type is chosen
143 according to the depth of the X display: xbm images
144 are chosen on monochrome displays and color images
145 are chosen on color displays. By using tix getim
146 age, you can advoid hard coding the pathnames of
147 the image files in your application. When success
148 ful, this command returns the name of the newly
149 created image, which can be used to configure the
150 -image option of the TK and Tix widgets.
151 """
152 return self.tk.call('tix', 'getimage', name)
153
154 def tix_option_get(self, name):
155 """Gets the options manitained by the Tix
156 scheme mechanism. Available options are:
157
158 active_bg active_fg bg
159 bold_font dark1_bg dark1_fg
160 dark2_bg dark2_fg disabled_fg
161 fg fixed_font font
162 inactive_bg inactive_fg input1_bg
163 input2_bg italic_font light1_bg
164 light1_fg light2_bg light2_fg
165 menu_font output1_bg output2_bg
166 select_bg select_fg selector
167 """
168 # could use self.tk.globalgetvar('tixOption', name)
169 return self.tk.call('tix', 'option', 'get', name)
170
171 def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None):
172 """Resets the scheme and fontset of the Tix application
173 to newScheme and newFontSet, respectively.
174 This affects only those widgets created after this
175 call. Therefore, it is best to call the resetop
176 tions command before the creation of any widgets in
177 a Tix application.
178
179 The optional parameter newScmPrio can be given to
180 reset the priority level of the TK options set by
181 the Tix schemes.
182
183 Because of the way TK handles the X option database, after
184 tixwish has started up, it is not possible to reset the
185 color schemes and font sets using the tix config command.
186 Instead, the tix resetoptions command must be used.
187 """
188 if newScmPrio is not None:
189 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio)
190 else:
191 return self.tk.call('tix', 'resetoptions', newScheme, newFontSet)
192
193class Tk(Tkinter.Tk, tixCommand):
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000194 """Toplevel widget of Tix which represents mostly the main window
195 of an application. It has an associated Tcl interpreter."""
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000196 def __init__(self, screenName=None, baseName=None, className='Tix'):
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000197 Tkinter.Tk.__init__(self, screenName, baseName, className)
Moshe Zadka22710822001-03-21 17:24:49 +0000198 tixlib = os.environ.get('TIX_LIBRARY')
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000199 self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]')
Moshe Zadka22710822001-03-21 17:24:49 +0000200 if tixlib is not None:
201 self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib)
202 self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000203 # Load Tix - this should work dynamically or statically
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000204 # If it's static, lib/tix8.1/pkgIndex.tcl should have
205 # 'load {} Tix'
206 # If it's dynamic, lib/tix8.1/pkgIndex.tcl should have
207 # 'load libtix8.1.8.3.so Tix'
Moshe Zadka22710822001-03-21 17:24:49 +0000208 self.tk.eval('package require Tix')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000209
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000210
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000211# The Tix 'tixForm' geometry manager
212class Form:
213 """The Tix Form geometry manager
214
215 Widgets can be arranged by specifying attachments to other widgets.
216 See Tix documentation for complete details"""
217
218 def config(self, cnf={}, **kw):
219 apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw))
220
221 form = config
222
223 def __setitem__(self, key, value):
Guido van Rossum49fa2bd2001-08-13 14:12:35 +0000224 Form.form(self, {key: value})
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000225
226 def check(self):
227 return self.tk.call('tixForm', 'check', self._w)
228
229 def forget(self):
230 self.tk.call('tixForm', 'forget', self._w)
231
232 def grid(self, xsize=0, ysize=0):
233 if (not xsize) and (not ysize):
234 x = self.tk.call('tixForm', 'grid', self._w)
235 y = self.tk.splitlist(x)
236 z = ()
237 for x in y:
238 z = z + (self.tk.getint(x),)
239 return z
240 self.tk.call('tixForm', 'grid', self._w, xsize, ysize)
241
242 def info(self, option=None):
243 if not option:
244 return self.tk.call('tixForm', 'info', self._w)
245 if option[0] != '-':
246 option = '-' + option
247 return self.tk.call('tixForm', 'info', self._w, option)
248
249 def slaves(self):
250 return map(self._nametowidget,
251 self.tk.splitlist(
252 self.tk.call(
253 'tixForm', 'slaves', self._w)))
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000254
255
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000256
257
258Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,)
259
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000260class TixWidget(Tkinter.Widget):
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000261 """A TixWidget class is used to package all (or most) Tix widgets.
262
263 Widget initialization is extended in two ways:
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000264 1) It is possible to give a list of options which must be part of
Moshe Zadka22710822001-03-21 17:24:49 +0000265 the creation command (so called Tix 'static' options). These cannot be
266 given as a 'config' command later.
267 2) It is possible to give the name of an existing TK widget. These are
268 child widgets created automatically by a Tix mega-widget. The Tk call
269 to create these widgets is therefore bypassed in TixWidget.__init__
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000270
271 Both options are for use by subclasses only.
272 """
273 def __init__ (self, master=None, widgetName=None,
Moshe Zadka22710822001-03-21 17:24:49 +0000274 static_options=None, cnf={}, kw={}):
275 # Merge keywords and dictionary arguments
276 if kw:
277 cnf = _cnfmerge((cnf, kw))
278 else:
279 cnf = _cnfmerge(cnf)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000280
Moshe Zadka22710822001-03-21 17:24:49 +0000281 # Move static options into extra. static_options must be
282 # a list of keywords (or None).
283 extra=()
284 if static_options:
285 for k,v in cnf.items()[:]:
286 if k in static_options:
287 extra = extra + ('-' + k, v)
288 del cnf[k]
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000289
Moshe Zadka22710822001-03-21 17:24:49 +0000290 self.widgetName = widgetName
291 Widget._setup(self, master, cnf)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000292
Moshe Zadka22710822001-03-21 17:24:49 +0000293 # If widgetName is None, this is a dummy creation call where the
294 # corresponding Tk widget has already been created by Tix
295 if widgetName:
296 apply(self.tk.call, (widgetName, self._w) + extra)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000297
Moshe Zadka22710822001-03-21 17:24:49 +0000298 # Non-static options - to be done via a 'config' command
299 if cnf:
300 Widget.config(self, cnf)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000301
Moshe Zadka22710822001-03-21 17:24:49 +0000302 # Dictionary to hold subwidget names for easier access. We can't
303 # use the children list because the public Tix names may not be the
304 # same as the pathname component
305 self.subwidget_list = {}
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000306
307 # We set up an attribute access function so that it is possible to
308 # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello'
309 # when w is a StdButtonBox.
310 # We can even do w.ok.invoke() because w.ok is subclassed from the
311 # Button class if you go through the proper constructors
312 def __getattr__(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +0000313 if self.subwidget_list.has_key(name):
314 return self.subwidget_list[name]
315 raise AttributeError, name
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000316
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000317 def set_silent(self, value):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000318 """Set a variable without calling its action routine"""
Moshe Zadka22710822001-03-21 17:24:49 +0000319 self.tk.call('tixSetSilent', self._w, value)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000320
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000321 def subwidget(self, name):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000322 """Return the named subwidget (which must have been created by
323 the sub-class)."""
Moshe Zadka22710822001-03-21 17:24:49 +0000324 n = self._subwidget_name(name)
325 if not n:
326 raise TclError, "Subwidget " + name + " not child of " + self._name
327 # Remove header of name and leading dot
328 n = n[len(self._w)+1:]
329 return self._nametowidget(n)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000330
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000331 def subwidgets_all(self):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000332 """Return all subwidgets."""
Moshe Zadka22710822001-03-21 17:24:49 +0000333 names = self._subwidget_names()
334 if not names:
335 return []
336 retlist = []
337 for name in names:
338 name = name[len(self._w)+1:]
339 try:
340 retlist.append(self._nametowidget(name))
341 except:
342 # some of the widgets are unknown e.g. border in LabelFrame
343 pass
344 return retlist
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000345
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000346 def _subwidget_name(self,name):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000347 """Get a subwidget name (returns a String, not a Widget !)"""
Moshe Zadka22710822001-03-21 17:24:49 +0000348 try:
349 return self.tk.call(self._w, 'subwidget', name)
350 except TclError:
351 return None
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000352
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000353 def _subwidget_names(self):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000354 """Return the name of all subwidgets."""
Moshe Zadka22710822001-03-21 17:24:49 +0000355 try:
356 x = self.tk.call(self._w, 'subwidgets', '-all')
357 return self.tk.split(x)
358 except TclError:
359 return None
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000360
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000361 def config_all(self, option, value):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000362 """Set configuration options for all subwidgets (and self)."""
Moshe Zadka22710822001-03-21 17:24:49 +0000363 if option == '':
364 return
365 elif type(option) != type(''):
366 option = `option`
367 if type(value) != type(''):
368 value = `value`
369 names = self._subwidget_names()
370 for name in names:
371 self.tk.call(name, 'configure', '-' + option, value)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000372
373# Subwidgets are child widgets created automatically by mega-widgets.
374# In python, we have to create these subwidgets manually to mirror their
375# existence in Tk/Tix.
376class TixSubWidget(TixWidget):
377 """Subwidget class.
378
379 This is used to mirror child widgets automatically created
380 by Tix/Tk as part of a mega-widget in Python (which is not informed
381 of this)"""
382
383 def __init__(self, master, name,
Moshe Zadka22710822001-03-21 17:24:49 +0000384 destroy_physically=1, check_intermediate=1):
385 if check_intermediate:
386 path = master._subwidget_name(name)
387 try:
388 path = path[len(master._w)+1:]
389 plist = string.splitfields(path, '.')
390 except:
391 plist = []
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000392
Moshe Zadka22710822001-03-21 17:24:49 +0000393 if (not check_intermediate) or len(plist) < 2:
394 # immediate descendant
395 TixWidget.__init__(self, master, None, None, {'name' : name})
396 else:
397 # Ensure that the intermediate widgets exist
398 parent = master
399 for i in range(len(plist) - 1):
400 n = string.joinfields(plist[:i+1], '.')
401 try:
402 w = master._nametowidget(n)
403 parent = w
404 except KeyError:
405 # Create the intermediate widget
406 parent = TixSubWidget(parent, plist[i],
407 destroy_physically=0,
408 check_intermediate=0)
409 TixWidget.__init__(self, parent, None, None, {'name' : name})
410 self.destroy_physically = destroy_physically
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000411
412 def destroy(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000413 # For some widgets e.g., a NoteBook, when we call destructors,
414 # we must be careful not to destroy the frame widget since this
415 # also destroys the parent NoteBook thus leading to an exception
416 # in Tkinter when it finally calls Tcl to destroy the NoteBook
417 for c in self.children.values(): c.destroy()
418 if self.master.children.has_key(self._name):
419 del self.master.children[self._name]
420 if self.master.subwidget_list.has_key(self._name):
421 del self.master.subwidget_list[self._name]
422 if self.destroy_physically:
423 # This is bypassed only for a few widgets
424 self.tk.call('destroy', self._w)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000425
426
427# Useful func. to split Tcl lists and return as a dict. From Tkinter.py
428def _lst2dict(lst):
429 dict = {}
430 for x in lst:
Moshe Zadka22710822001-03-21 17:24:49 +0000431 dict[x[0][1:]] = (x[0][1:],) + x[1:]
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000432 return dict
433
434# Useful class to create a display style - later shared by many items.
435# Contributed by Steffen Kremser
436class DisplayStyle:
437 """DisplayStyle - handle configuration options shared by
438 (multiple) Display Items"""
439
440 def __init__(self, itemtype, cnf={}, **kw ):
Moshe Zadka22710822001-03-21 17:24:49 +0000441 master = _default_root # global from Tkinter
442 if not master and cnf.has_key('refwindow'): master=cnf['refwindow']
443 elif not master and kw.has_key('refwindow'): master= kw['refwindow']
444 elif not master: raise RuntimeError, "Too early to create display style: no root window"
445 self.tk = master.tk
446 self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) +
447 self._options(cnf,kw) )
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000448
449 def __str__(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000450 return self.stylename
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000451
452 def _options(self, cnf, kw ):
Moshe Zadka22710822001-03-21 17:24:49 +0000453 if kw and cnf:
454 cnf = _cnfmerge((cnf, kw))
455 elif kw:
456 cnf = kw
457 opts = ()
458 for k, v in cnf.items():
459 opts = opts + ('-'+k, v)
460 return opts
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000461
462 def delete(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000463 self.tk.call(self.stylename, 'delete')
464 del(self)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000465
466 def __setitem__(self,key,value):
Moshe Zadka22710822001-03-21 17:24:49 +0000467 self.tk.call(self.stylename, 'configure', '-%s'%key, value)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000468
469 def config(self, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000470 return _lst2dict(
471 self.tk.split(
472 apply(self.tk.call,
473 (self.stylename, 'configure') + self._options(cnf,kw))))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000474
475 def __getitem__(self,key):
Guido van Rossum49fa2bd2001-08-13 14:12:35 +0000476 return self.tk.call(self.stylename, 'cget', '-%s'%key)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000477
478
479######################################################
480### The Tix Widget classes - in alphabetical order ###
481######################################################
482
483class Balloon(TixWidget):
484 """Balloon help widget.
485
Moshe Zadka22710822001-03-21 17:24:49 +0000486 Subwidget Class
487 --------- -----
488 label Label
489 message Message"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000490
491 def __init__(self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000492 TixWidget.__init__(self, master, 'tixBalloon', ['options'], cnf, kw)
493 self.subwidget_list['label'] = _dummyLabel(self, 'label',
494 destroy_physically=0)
495 self.subwidget_list['message'] = _dummyLabel(self, 'message',
496 destroy_physically=0)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000497
498 def bind_widget(self, widget, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000499 """Bind balloon widget to another.
500 One balloon widget may be bound to several widgets at the same time"""
501 apply(self.tk.call,
502 (self._w, 'bind', widget._w) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000503
504 def unbind_widget(self, widget):
Moshe Zadka22710822001-03-21 17:24:49 +0000505 self.tk.call(self._w, 'unbind', widget._w)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000506
507class ButtonBox(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000508 """ButtonBox - A container for pushbuttons.
509 Subwidgets are the buttons added with the add method.
510 """
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000511 def __init__(self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000512 TixWidget.__init__(self, master, 'tixButtonBox',
513 ['orientation', 'options'], cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000514
515 def add(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000516 """Add a button with given name to box."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000517
Moshe Zadka22710822001-03-21 17:24:49 +0000518 btn = apply(self.tk.call,
519 (self._w, 'add', name) + self._options(cnf, kw))
520 self.subwidget_list[name] = _dummyButton(self, name)
521 return btn
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000522
523 def invoke(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +0000524 if self.subwidget_list.has_key(name):
525 self.tk.call(self._w, 'invoke', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000526
527class ComboBox(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000528 """ComboBox - an Entry field with a dropdown menu. The user can select a
529 choice by either typing in the entry subwdget or selecting from the
530 listbox subwidget.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000531
Moshe Zadka22710822001-03-21 17:24:49 +0000532 Subwidget Class
533 --------- -----
534 entry Entry
535 arrow Button
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000536 slistbox ScrolledListBox
537 tick Button
538 cross Button : present if created with the fancy option"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000539
540 def __init__ (self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000541 TixWidget.__init__(self, master, 'tixComboBox',
542 ['editable', 'dropdown', 'fancy', 'options'],
543 cnf, kw)
544 self.subwidget_list['label'] = _dummyLabel(self, 'label')
545 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
546 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
547 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
548 'slistbox')
549 try:
550 self.subwidget_list['tick'] = _dummyButton(self, 'tick')
551 self.subwidget_list['cross'] = _dummyButton(self, 'cross')
552 except TypeError:
553 # unavailable when -fancy not specified
554 pass
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000555
556 def add_history(self, str):
Moshe Zadka22710822001-03-21 17:24:49 +0000557 self.tk.call(self._w, 'addhistory', str)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000558
559 def append_history(self, str):
Moshe Zadka22710822001-03-21 17:24:49 +0000560 self.tk.call(self._w, 'appendhistory', str)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000561
562 def insert(self, index, str):
Moshe Zadka22710822001-03-21 17:24:49 +0000563 self.tk.call(self._w, 'insert', index, str)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000564
565 def pick(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +0000566 self.tk.call(self._w, 'pick', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000567
568class Control(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000569 """Control - An entry field with value change arrows. The user can
570 adjust the value by pressing the two arrow buttons or by entering
571 the value directly into the entry. The new value will be checked
572 against the user-defined upper and lower limits.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000573
Moshe Zadka22710822001-03-21 17:24:49 +0000574 Subwidget Class
575 --------- -----
576 incr Button
577 decr Button
578 entry Entry
579 label Label"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000580
581 def __init__ (self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000582 TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw)
583 self.subwidget_list['incr'] = _dummyButton(self, 'incr')
584 self.subwidget_list['decr'] = _dummyButton(self, 'decr')
585 self.subwidget_list['label'] = _dummyLabel(self, 'label')
586 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000587
588 def decrement(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000589 self.tk.call(self._w, 'decr')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000590
591 def increment(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000592 self.tk.call(self._w, 'incr')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000593
594 def invoke(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000595 self.tk.call(self._w, 'invoke')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000596
597 def update(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000598 self.tk.call(self._w, 'update')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000599
600class DirList(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000601 """DirList - displays a list view of a directory, its previous
602 directories and its sub-directories. The user can choose one of
603 the directories displayed in the list or change to another directory.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000604
Moshe Zadka22710822001-03-21 17:24:49 +0000605 Subwidget Class
606 --------- -----
607 hlist HList
608 hsb Scrollbar
609 vsb Scrollbar"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000610
611 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000612 TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
613 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
614 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
615 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000616
617 def chdir(self, dir):
Moshe Zadka22710822001-03-21 17:24:49 +0000618 self.tk.call(self._w, 'chdir', dir)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000619
620class DirTree(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000621 """DirTree - Directory Listing in a hierarchical view.
622 Displays a tree view of a directory, its previous directories and its
623 sub-directories. The user can choose one of the directories displayed
624 in the list or change to another directory.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000625
Moshe Zadka22710822001-03-21 17:24:49 +0000626 Subwidget Class
627 --------- -----
628 hlist HList
629 hsb Scrollbar
630 vsb Scrollbar"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000631
632 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000633 TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw)
634 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
635 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
636 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000637
638 def chdir(self, dir):
Moshe Zadka22710822001-03-21 17:24:49 +0000639 self.tk.call(self._w, 'chdir', dir)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000640
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000641class DirSelectBox(TixWidget):
642 """DirSelectBox - Motif style file select box.
643 It is generally used for
644 the user to choose a file. FileSelectBox stores the files mostly
645 recently selected into a ComboBox widget so that they can be quickly
646 selected again.
647
648 Subwidget Class
649 --------- -----
650 selection ComboBox
651 filter ComboBox
652 dirlist ScrolledListBox
653 filelist ScrolledListBox"""
654
655 def __init__(self, master, cnf={}, **kw):
656 TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw)
657 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
658 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
659
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000660class ExFileSelectBox(TixWidget):
661 """ExFileSelectBox - MS Windows style file select box.
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000662 It provides an convenient method for the user to select files.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000663
Moshe Zadka22710822001-03-21 17:24:49 +0000664 Subwidget Class
665 --------- -----
666 cancel Button
667 ok Button
668 hidden Checkbutton
669 types ComboBox
670 dir ComboBox
671 file ComboBox
672 dirlist ScrolledListBox
673 filelist ScrolledListBox"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000674
675 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000676 TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw)
677 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
678 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
679 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
680 self.subwidget_list['types'] = _dummyComboBox(self, 'types')
681 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
682 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
683 self.subwidget_list['file'] = _dummyComboBox(self, 'file')
684 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000685
686 def filter(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000687 self.tk.call(self._w, 'filter')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000688
689 def invoke(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000690 self.tk.call(self._w, 'invoke')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000691
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000692
693# Should inherit from a Dialog class
694class DirSelectDialog(TixWidget):
695 """The DirSelectDialog widget presents the directories in the file
696 system in a dialog window. The user can use this dialog window to
697 navigate through the file system to select the desired directory.
698
699 Subwidgets Class
700 ---------- -----
701 dirbox DirSelectDialog"""
702
703 def __init__(self, master, cnf={}, **kw):
704 TixWidget.__init__(self, master, 'tixDirSelectDialog',
705 ['options'], cnf, kw)
706 self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox')
707 # cancel and ok buttons are missing
708
709 def popup(self):
710 self.tk.call(self._w, 'popup')
711
712 def popdown(self):
713 self.tk.call(self._w, 'popdown')
714
715
716# Should inherit from a Dialog class
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000717class ExFileSelectDialog(TixWidget):
718 """ExFileSelectDialog - MS Windows style file select dialog.
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000719 It provides an convenient method for the user to select files.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000720
Moshe Zadka22710822001-03-21 17:24:49 +0000721 Subwidgets Class
722 ---------- -----
723 fsbox ExFileSelectBox"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000724
725 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000726 TixWidget.__init__(self, master, 'tixExFileSelectDialog',
727 ['options'], cnf, kw)
728 self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000729
730 def popup(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000731 self.tk.call(self._w, 'popup')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000732
733 def popdown(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000734 self.tk.call(self._w, 'popdown')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000735
736class FileSelectBox(TixWidget):
737 """ExFileSelectBox - Motif style file select box.
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000738 It is generally used for
739 the user to choose a file. FileSelectBox stores the files mostly
740 recently selected into a ComboBox widget so that they can be quickly
741 selected again.
742
Moshe Zadka22710822001-03-21 17:24:49 +0000743 Subwidget Class
744 --------- -----
745 selection ComboBox
746 filter ComboBox
747 dirlist ScrolledListBox
748 filelist ScrolledListBox"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000749
750 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000751 TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw)
752 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
753 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
754 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
755 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000756
Moshe Zadka22710822001-03-21 17:24:49 +0000757 def apply_filter(self): # name of subwidget is same as command
758 self.tk.call(self._w, 'filter')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000759
760 def invoke(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000761 self.tk.call(self._w, 'invoke')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000762
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000763# Should inherit from a Dialog class
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000764class FileSelectDialog(TixWidget):
765 """FileSelectDialog - Motif style file select dialog.
766
Moshe Zadka22710822001-03-21 17:24:49 +0000767 Subwidgets Class
768 ---------- -----
769 btns StdButtonBox
770 fsbox FileSelectBox"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000771
772 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000773 TixWidget.__init__(self, master, 'tixFileSelectDialog',
774 ['options'], cnf, kw)
775 self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns')
776 self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000777
778 def popup(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000779 self.tk.call(self._w, 'popup')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000780
781 def popdown(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000782 self.tk.call(self._w, 'popdown')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000783
784class FileEntry(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000785 """FileEntry - Entry field with button that invokes a FileSelectDialog.
786 The user can type in the filename manually. Alternatively, the user can
787 press the button widget that sits next to the entry, which will bring
788 up a file selection dialog.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000789
Moshe Zadka22710822001-03-21 17:24:49 +0000790 Subwidgets Class
791 ---------- -----
792 button Button
793 entry Entry"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000794
795 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000796 TixWidget.__init__(self, master, 'tixFileEntry',
797 ['dialogtype', 'options'], cnf, kw)
798 self.subwidget_list['button'] = _dummyButton(self, 'button')
799 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000800
801 def invoke(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000802 self.tk.call(self._w, 'invoke')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000803
804 def file_dialog(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000805 # XXX return python object
806 pass
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000807
808class HList(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +0000809 """HList - Hierarchy display widget can be used to display any data
810 that have a hierarchical structure, for example, file system directory
811 trees. The list entries are indented and connected by branch lines
812 according to their places in the hierachy.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000813
814 Subwidgets - None"""
815
816 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000817 TixWidget.__init__(self, master, 'tixHList',
818 ['columns', 'options'], cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000819
820 def add(self, entry, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000821 return apply(self.tk.call,
822 (self._w, 'add', entry) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000823
824 def add_child(self, parent=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000825 if not parent:
826 parent = ''
827 return apply(self.tk.call,
828 (self._w, 'addchild', parent) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000829
830 def anchor_set(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000831 self.tk.call(self._w, 'anchor', 'set', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000832
833 def anchor_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000834 self.tk.call(self._w, 'anchor', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000835
836 def column_width(self, col=0, width=None, chars=None):
Moshe Zadka22710822001-03-21 17:24:49 +0000837 if not chars:
838 return self.tk.call(self._w, 'column', 'width', col, width)
839 else:
840 return self.tk.call(self._w, 'column', 'width', col,
841 '-char', chars)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000842
843 def delete_all(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000844 self.tk.call(self._w, 'delete', 'all')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000845
846 def delete_entry(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000847 self.tk.call(self._w, 'delete', 'entry', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000848
849 def delete_offsprings(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000850 self.tk.call(self._w, 'delete', 'offsprings', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000851
852 def delete_siblings(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000853 self.tk.call(self._w, 'delete', 'siblings', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000854
855 def dragsite_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +0000856 self.tk.call(self._w, 'dragsite', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000857
858 def dragsite_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000859 self.tk.call(self._w, 'dragsite', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000860
861 def dropsite_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +0000862 self.tk.call(self._w, 'dropsite', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000863
864 def dropsite_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000865 self.tk.call(self._w, 'dropsite', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000866
867 def header_create(self, col, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000868 apply(self.tk.call,
869 (self._w, 'header', 'create', col) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000870
871 def header_configure(self, col, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000872 if cnf is None:
873 return _lst2dict(
874 self.tk.split(
875 self.tk.call(self._w, 'header', 'configure', col)))
876 apply(self.tk.call, (self._w, 'header', 'configure', col)
877 + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000878
879 def header_cget(self, col, opt):
Moshe Zadka22710822001-03-21 17:24:49 +0000880 return self.tk.call(self._w, 'header', 'cget', col, opt)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000881
882 def header_exists(self, col):
Moshe Zadka22710822001-03-21 17:24:49 +0000883 return self.tk.call(self._w, 'header', 'exists', col)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000884
885 def header_delete(self, col):
Moshe Zadka22710822001-03-21 17:24:49 +0000886 self.tk.call(self._w, 'header', 'delete', col)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000887
888 def header_size(self, col):
Moshe Zadka22710822001-03-21 17:24:49 +0000889 return self.tk.call(self._w, 'header', 'size', col)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000890
891 def hide_entry(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000892 self.tk.call(self._w, 'hide', 'entry', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000893
894 def indicator_create(self, entry, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000895 apply(self.tk.call,
896 (self._w, 'indicator', 'create', entry) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000897
898 def indicator_configure(self, entry, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000899 if cnf is None:
900 return _lst2dict(
901 self.tk.split(
902 self.tk.call(self._w, 'indicator', 'configure', entry)))
903 apply(self.tk.call,
904 (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000905
906 def indicator_cget(self, entry, opt):
Moshe Zadka22710822001-03-21 17:24:49 +0000907 return self.tk.call(self._w, 'indicator', 'cget', entry, opt)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000908
909 def indicator_exists(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000910 return self.tk.call (self._w, 'indicator', 'exists', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000911
912 def indicator_delete(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000913 self.tk.call(self._w, 'indicator', 'delete', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000914
915 def indicator_size(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000916 return self.tk.call(self._w, 'indicator', 'size', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000917
918 def info_anchor(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000919 return self.tk.call(self._w, 'info', 'anchor')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000920
921 def info_children(self, entry=None):
Moshe Zadka22710822001-03-21 17:24:49 +0000922 c = self.tk.call(self._w, 'info', 'children', entry)
923 return self.tk.splitlist(c)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000924
925 def info_data(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000926 return self.tk.call(self._w, 'info', 'data', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000927
928 def info_exists(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000929 return self.tk.call(self._w, 'info', 'exists', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000930
931 def info_hidden(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000932 return self.tk.call(self._w, 'info', 'hidden', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000933
934 def info_next(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000935 return self.tk.call(self._w, 'info', 'next', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000936
937 def info_parent(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000938 return self.tk.call(self._w, 'info', 'parent', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000939
940 def info_prev(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000941 return self.tk.call(self._w, 'info', 'prev', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000942
943 def info_selection(self):
Moshe Zadka22710822001-03-21 17:24:49 +0000944 c = self.tk.call(self._w, 'info', 'selection')
945 return self.tk.splitlist(c)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000946
Martin v. Löwis3e048482001-10-09 11:50:55 +0000947 def item_cget(self, entry, col, opt):
948 return self.tk.call(self._w, 'item', 'cget', entry, col, opt)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000949
950 def item_configure(self, entry, col, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000951 if cnf is None:
952 return _lst2dict(
953 self.tk.split(
954 self.tk.call(self._w, 'item', 'configure', entry, col)))
955 apply(self.tk.call, (self._w, 'item', 'configure', entry, col) +
956 self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000957
958 def item_create(self, entry, col, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000959 apply(self.tk.call,
960 (self._w, 'item', 'create', entry, col) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000961
962 def item_exists(self, entry, col):
Moshe Zadka22710822001-03-21 17:24:49 +0000963 return self.tk.call(self._w, 'item', 'exists', entry, col)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000964
965 def item_delete(self, entry, col):
Moshe Zadka22710822001-03-21 17:24:49 +0000966 self.tk.call(self._w, 'item', 'delete', entry, col)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000967
968 def nearest(self, y):
Moshe Zadka22710822001-03-21 17:24:49 +0000969 return self.tk.call(self._w, 'nearest', y)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000970
971 def see(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000972 self.tk.call(self._w, 'see', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000973
974 def selection_clear(self, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000975 apply(self.tk.call,
976 (self._w, 'selection', 'clear') + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000977
978 def selection_includes(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000979 return self.tk.call(self._w, 'selection', 'includes', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000980
981 def selection_set(self, first, last=None):
Moshe Zadka22710822001-03-21 17:24:49 +0000982 self.tk.call(self._w, 'selection', 'set', first, last)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000983
984 def show_entry(self, entry):
Moshe Zadka22710822001-03-21 17:24:49 +0000985 return self.tk.call(self._w, 'show', 'entry', entry)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000986
987 def xview(self, *args):
Moshe Zadka22710822001-03-21 17:24:49 +0000988 apply(self.tk.call, (self._w, 'xview') + args)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000989
990 def yview(self, *args):
Moshe Zadka22710822001-03-21 17:24:49 +0000991 apply(self.tk.call, (self._w, 'yview') + args)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +0000992
993class InputOnly(TixWidget):
994 """InputOnly - Invisible widget.
995
996 Subwidgets - None"""
997
998 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +0000999 TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001000
1001class LabelEntry(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001002 """LabelEntry - Entry field with label. Packages an entry widget
1003 and a label into one mega widget. It can beused be used to simplify
1004 the creation of ``entry-form'' type of interface.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001005
Moshe Zadka22710822001-03-21 17:24:49 +00001006 Subwidgets Class
1007 ---------- -----
1008 label Label
1009 entry Entry"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001010
1011 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001012 TixWidget.__init__(self, master, 'tixLabelEntry',
1013 ['labelside','options'], cnf, kw)
1014 self.subwidget_list['label'] = _dummyLabel(self, 'label')
1015 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001016
1017class LabelFrame(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001018 """LabelFrame - Labelled Frame container. Packages a frame widget
1019 and a label into one mega widget. To create widgets inside a
1020 LabelFrame widget, one creates the new widgets relative to the
1021 frame subwidget and manage them inside the frame subwidget.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001022
Moshe Zadka22710822001-03-21 17:24:49 +00001023 Subwidgets Class
1024 ---------- -----
1025 label Label
1026 frame Frame"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001027
1028 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001029 TixWidget.__init__(self, master, 'tixLabelFrame',
1030 ['labelside','options'], cnf, kw)
1031 self.subwidget_list['label'] = _dummyLabel(self, 'label')
1032 self.subwidget_list['frame'] = _dummyFrame(self, 'frame')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001033
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001034
1035class ListNoteBook(TixWidget):
1036 """A ListNoteBook widget is very similar to the TixNoteBook widget:
1037 it can be used to display many windows in a limited space using a
1038 notebook metaphor. The notebook is divided into a stack of pages
1039 (windows). At one time only one of these pages can be shown.
1040 The user can navigate through these pages by
1041 choosing the name of the desired page in the hlist subwidget."""
1042
1043 def __init__(self, master, cnf={}, **kw):
1044 TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw)
1045 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1046 self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb')
1047
1048
1049 def add(self, name, cnf={}, **kw):
1050 apply(self.tk.call,
1051 (self._w, 'add', name) + self._options(cnf, kw))
1052 self.subwidget_list[name] = TixSubWidget(self, name)
1053 return self.subwidget_list[name]
1054
1055 def raise_page(self, name): # raise is a python keyword
1056 self.tk.call(self._w, 'raise', name)
1057
1058class Meter(TixWidget):
1059 """The Meter widget can be used to show the progress of a background
1060 job which may take a long time to execute.
1061 """
1062
1063 def __init__(self, master=None, cnf={}, **kw):
1064 TixWidget.__init__(self, master, 'tixMeter',
1065 ['options'], cnf, kw)
1066
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001067class NoteBook(TixWidget):
1068 """NoteBook - Multi-page container widget (tabbed notebook metaphor).
1069
Moshe Zadka22710822001-03-21 17:24:49 +00001070 Subwidgets Class
1071 ---------- -----
1072 nbframe NoteBookFrame
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001073 <pages> page widgets added dynamically with the add method"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001074
1075 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001076 TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw)
1077 self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe',
1078 destroy_physically=0)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001079
1080 def add(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001081 apply(self.tk.call,
1082 (self._w, 'add', name) + self._options(cnf, kw))
1083 self.subwidget_list[name] = TixSubWidget(self, name)
1084 return self.subwidget_list[name]
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001085
1086 def delete(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001087 self.tk.call(self._w, 'delete', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001088
1089 def page(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001090 return self.subwidget(name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001091
1092 def pages(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001093 # Can't call subwidgets_all directly because we don't want .nbframe
1094 names = self.tk.split(self.tk.call(self._w, 'pages'))
1095 ret = []
1096 for x in names:
1097 ret.append(self.subwidget(x))
1098 return ret
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001099
Moshe Zadka22710822001-03-21 17:24:49 +00001100 def raise_page(self, name): # raise is a python keyword
1101 self.tk.call(self._w, 'raise', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001102
1103 def raised(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001104 return self.tk.call(self._w, 'raised')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001105
1106class NoteBookFrame(TixWidget):
1107 """Will be added when Tix documentation is available !!!"""
1108 pass
1109
1110class OptionMenu(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001111 """OptionMenu - creates a menu button of options.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001112
Moshe Zadka22710822001-03-21 17:24:49 +00001113 Subwidget Class
1114 --------- -----
1115 menubutton Menubutton
1116 menu Menu"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001117
1118 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001119 TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw)
1120 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
1121 self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001122
1123 def add_command(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001124 apply(self.tk.call,
1125 (self._w, 'add', 'command', name) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001126
1127 def add_separator(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001128 apply(self.tk.call,
1129 (self._w, 'add', 'separator', name) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001130
1131 def delete(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001132 self.tk.call(self._w, 'delete', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001133
1134 def disable(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001135 self.tk.call(self._w, 'disable', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001136
1137 def enable(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001138 self.tk.call(self._w, 'enable', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001139
1140class PanedWindow(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001141 """PanedWindow - Multi-pane container widget
1142 allows the user to interactively manipulate the sizes of several
1143 panes. The panes can be arranged either vertically or horizontally.The
1144 user changes the sizes of the panes by dragging the resize handle
1145 between two panes.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001146
Moshe Zadka22710822001-03-21 17:24:49 +00001147 Subwidgets Class
1148 ---------- -----
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001149 <panes> g/p widgets added dynamically with the add method."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001150
1151 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001152 TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001153
1154 def add(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001155 apply(self.tk.call,
1156 (self._w, 'add', name) + self._options(cnf, kw))
1157 self.subwidget_list[name] = TixSubWidget(self, name,
1158 check_intermediate=0)
1159 return self.subwidget_list[name]
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001160
1161 def panes(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001162 names = self.tk.call(self._w, 'panes')
1163 ret = []
1164 for x in names:
1165 ret.append(self.subwidget(x))
1166 return ret
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001167
1168class PopupMenu(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001169 """PopupMenu widget can be used as a replacement of the tk_popup command.
1170 The advantage of the Tix PopupMenu widget is it requires less application
1171 code to manipulate.
1172
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001173
Moshe Zadka22710822001-03-21 17:24:49 +00001174 Subwidgets Class
1175 ---------- -----
1176 menubutton Menubutton
1177 menu Menu"""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001178
1179 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001180 TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw)
1181 self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton')
1182 self.subwidget_list['menu'] = _dummyMenu(self, 'menu')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001183
1184 def bind_widget(self, widget):
Moshe Zadka22710822001-03-21 17:24:49 +00001185 self.tk.call(self._w, 'bind', widget._w)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001186
1187 def unbind_widget(self, widget):
Moshe Zadka22710822001-03-21 17:24:49 +00001188 self.tk.call(self._w, 'unbind', widget._w)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001189
1190 def post_widget(self, widget, x, y):
Moshe Zadka22710822001-03-21 17:24:49 +00001191 self.tk.call(self._w, 'post', widget._w, x, y)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001192
1193class ResizeHandle(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001194 """Internal widget to draw resize handles on Scrolled widgets."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001195
1196 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001197 TixWidget.__init__(self, master, 'tixResizeHandle',
1198 ['options'], cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001199
1200 def attach_widget(self, widget):
Moshe Zadka22710822001-03-21 17:24:49 +00001201 self.tk.call(self._w, 'attachwidget', widget._w)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001202
1203class ScrolledHList(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001204 """ScrolledHList - HList with automatic scrollbars."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001205
1206 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001207 TixWidget.__init__(self, master, 'tixScrolledHList', ['options'],
1208 cnf, kw)
1209 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1210 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1211 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001212
1213class ScrolledListBox(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001214 """ScrolledListBox - Listbox with automatic scrollbars."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001215
1216 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001217 TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw)
1218 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
1219 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1220 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001221
1222class ScrolledText(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001223 """ScrolledText - Text with automatic scrollbars."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001224
1225 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001226 TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw)
1227 self.subwidget_list['text'] = _dummyText(self, 'text')
1228 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1229 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001230
1231class ScrolledTList(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001232 """ScrolledTList - TList with automatic scrollbars."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001233
1234 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001235 TixWidget.__init__(self, master, 'tixScrolledTList', ['options'],
1236 cnf, kw)
1237 self.subwidget_list['tlist'] = _dummyTList(self, 'tlist')
1238 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1239 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001240
1241class ScrolledWindow(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001242 """ScrolledWindow - Window with automatic scrollbars."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001243
1244 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001245 TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
1246 self.subwidget_list['window'] = _dummyFrame(self, 'window')
1247 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1248 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001249
1250class Select(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001251 """Select - Container of button subwidgets. It can be used to provide
1252 radio-box or check-box style of selection options for the user.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001253
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001254 Subwidgets are buttons added dynamically using the add method."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001255
1256 def __init__(self, master, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001257 TixWidget.__init__(self, master, 'tixSelect',
1258 ['allowzero', 'radio', 'orientation', 'labelside',
1259 'options'],
1260 cnf, kw)
1261 self.subwidget_list['label'] = _dummyLabel(self, 'label')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001262
1263 def add(self, name, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001264 apply(self.tk.call,
1265 (self._w, 'add', name) + self._options(cnf, kw))
1266 self.subwidget_list[name] = _dummyButton(self, name)
1267 return self.subwidget_list[name]
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001268
1269 def invoke(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001270 self.tk.call(self._w, 'invoke', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001271
1272class StdButtonBox(TixWidget):
1273 """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """
1274
1275 def __init__(self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001276 TixWidget.__init__(self, master, 'tixStdButtonBox',
1277 ['orientation', 'options'], cnf, kw)
1278 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
1279 self.subwidget_list['apply'] = _dummyButton(self, 'apply')
1280 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
1281 self.subwidget_list['help'] = _dummyButton(self, 'help')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001282
1283 def invoke(self, name):
Moshe Zadka22710822001-03-21 17:24:49 +00001284 if self.subwidget_list.has_key(name):
1285 self.tk.call(self._w, 'invoke', name)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001286
1287class TList(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001288 """TList - Hierarchy display widget which can be
1289 used to display data in a tabular format. The list entries of a TList
1290 widget are similar to the entries in the Tk listbox widget. The main
1291 differences are (1) the TList widget can display the list entries in a
1292 two dimensional format and (2) you can use graphical images as well as
1293 multiple colors and fonts for the list entries.
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001294
1295 Subwidgets - None"""
1296
1297 def __init__ (self,master=None,cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001298 TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001299
1300 def active_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001301 self.tk.call(self._w, 'active', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001302
1303 def active_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001304 self.tk.call(self._w, 'active', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001305
1306 def anchor_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001307 self.tk.call(self._w, 'anchor', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001308
1309 def anchor_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001310 self.tk.call(self._w, 'anchor', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001311
1312 def delete(self, from_, to=None):
Moshe Zadka22710822001-03-21 17:24:49 +00001313 self.tk.call(self._w, 'delete', from_, to)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001314
1315 def dragsite_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001316 self.tk.call(self._w, 'dragsite', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001317
1318 def dragsite_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001319 self.tk.call(self._w, 'dragsite', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001320
1321 def dropsite_set(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001322 self.tk.call(self._w, 'dropsite', 'set', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001323
1324 def dropsite_clear(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001325 self.tk.call(self._w, 'dropsite', 'clear')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001326
1327 def insert(self, index, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001328 apply(self.tk.call,
1329 (self._w, 'insert', index) + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001330
1331 def info_active(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001332 return self.tk.call(self._w, 'info', 'active')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001333
1334 def info_anchor(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001335 return self.tk.call(self._w, 'info', 'anchor')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001336
1337 def info_down(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001338 return self.tk.call(self._w, 'info', 'down', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001339
1340 def info_left(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001341 return self.tk.call(self._w, 'info', 'left', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001342
1343 def info_right(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001344 return self.tk.call(self._w, 'info', 'right', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001345
1346 def info_selection(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001347 c = self.tk.call(self._w, 'info', 'selection')
1348 return self.tk.splitlist(c)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001349
1350 def info_size(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001351 return self.tk.call(self._w, 'info', 'size')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001352
1353 def info_up(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001354 return self.tk.call(self._w, 'info', 'up', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001355
1356 def nearest(self, x, y):
Moshe Zadka22710822001-03-21 17:24:49 +00001357 return self.tk.call(self._w, 'nearest', x, y)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001358
1359 def see(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001360 self.tk.call(self._w, 'see', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001361
1362 def selection_clear(self, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001363 apply(self.tk.call,
1364 (self._w, 'selection', 'clear') + self._options(cnf, kw))
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001365
1366 def selection_includes(self, index):
Moshe Zadka22710822001-03-21 17:24:49 +00001367 return self.tk.call(self._w, 'selection', 'includes', index)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001368
1369 def selection_set(self, first, last=None):
Moshe Zadka22710822001-03-21 17:24:49 +00001370 self.tk.call(self._w, 'selection', 'set', first, last)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001371
1372 def xview(self, *args):
Moshe Zadka22710822001-03-21 17:24:49 +00001373 apply(self.tk.call, (self._w, 'xview') + args)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001374
1375 def yview(self, *args):
Moshe Zadka22710822001-03-21 17:24:49 +00001376 apply(self.tk.call, (self._w, 'yview') + args)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001377
1378class Tree(TixWidget):
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001379 """Tree - The tixTree widget can be used to display hierachical
1380 data in a tree form. The user can adjust
1381 the view of the tree by opening or closing parts of the tree."""
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001382
1383 def __init__(self, master=None, cnf={}, **kw):
Moshe Zadka22710822001-03-21 17:24:49 +00001384 TixWidget.__init__(self, master, 'tixTree',
1385 ['options'], cnf, kw)
1386 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1387 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1388 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001389
1390 def autosetmode(self):
Moshe Zadka22710822001-03-21 17:24:49 +00001391 self.tk.call(self._w, 'autosetmode')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001392
1393 def close(self, entrypath):
Moshe Zadka22710822001-03-21 17:24:49 +00001394 self.tk.call(self._w, 'close', entrypath)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001395
1396 def getmode(self, entrypath):
Moshe Zadka22710822001-03-21 17:24:49 +00001397 return self.tk.call(self._w, 'getmode', entrypath)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001398
1399 def open(self, entrypath):
Moshe Zadka22710822001-03-21 17:24:49 +00001400 self.tk.call(self._w, 'open', entrypath)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001401
1402 def setmode(self, entrypath, mode='none'):
Moshe Zadka22710822001-03-21 17:24:49 +00001403 self.tk.call(self._w, 'setmode', entrypath, mode)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001404
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001405
1406# Could try subclassing Tree for CheckList - would need another arg to init
1407class CheckList(TixWidget):
1408 """The CheckList widget
1409 displays a list of items to be selected by the user. CheckList acts
1410 similarly to the Tk checkbutton or radiobutton widgets, except it is
1411 capable of handling many more items than checkbuttons or radiobuttons.
1412 """
1413
1414 def __init__(self, master=None, cnf={}, **kw):
1415 TixWidget.__init__(self, master, 'tixCheckList',
1416 ['options'], cnf, kw)
1417 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1418 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1419 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
1420
1421 def autosetmode(self):
1422 self.tk.call(self._w, 'autosetmode')
1423
1424 def close(self, entrypath):
1425 self.tk.call(self._w, 'close', entrypath)
1426
1427 def getmode(self, entrypath):
1428 return self.tk.call(self._w, 'getmode', entrypath)
1429
1430 def open(self, entrypath):
1431 self.tk.call(self._w, 'open', entrypath)
1432
1433 def getselection(self, mode='on'):
1434 '''Mode can be on, off, default'''
1435 self.tk.call(self._w, 'getselection', mode)
1436
1437 def getstatus(self, entrypath):
1438 self.tk.call(self._w, 'getstatus', entrypath)
1439
1440 def setstatus(self, entrypath, mode='on'):
1441 self.tk.call(self._w, 'setstatus', entrypath, mode)
1442
1443
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001444###########################################################################
1445### The subclassing below is used to instantiate the subwidgets in each ###
1446### mega widget. This allows us to access their methods directly. ###
1447###########################################################################
1448
1449class _dummyButton(Button, TixSubWidget):
1450 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001451 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001452
1453class _dummyCheckbutton(Checkbutton, TixSubWidget):
1454 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001455 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001456
1457class _dummyEntry(Entry, TixSubWidget):
1458 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001459 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001460
1461class _dummyFrame(Frame, TixSubWidget):
1462 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001463 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001464
1465class _dummyLabel(Label, TixSubWidget):
1466 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001467 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001468
1469class _dummyListbox(Listbox, TixSubWidget):
1470 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001471 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001472
1473class _dummyMenu(Menu, TixSubWidget):
1474 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001475 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001476
1477class _dummyMenubutton(Menubutton, TixSubWidget):
1478 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001479 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001480
1481class _dummyScrollbar(Scrollbar, TixSubWidget):
1482 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001483 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001484
1485class _dummyText(Text, TixSubWidget):
1486 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001487 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001488
1489class _dummyScrolledListBox(ScrolledListBox, TixSubWidget):
1490 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001491 TixSubWidget.__init__(self, master, name, destroy_physically)
1492 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox')
1493 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1494 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001495
1496class _dummyHList(HList, TixSubWidget):
1497 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001498 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001499
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001500class _dummyScrolledHList(ScrolledHList, TixSubWidget):
1501 def __init__(self, master, name, destroy_physically=1):
1502 TixSubWidget.__init__(self, master, name, destroy_physically)
1503 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1504 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1505 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
1506
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001507class _dummyTList(TList, TixSubWidget):
1508 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001509 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001510
1511class _dummyComboBox(ComboBox, TixSubWidget):
1512 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001513 TixSubWidget.__init__(self, master, name, destroy_physically)
1514 self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
1515 self.subwidget_list['arrow'] = _dummyButton(self, 'arrow')
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001516 # I'm not sure about this destroy_physically=0 in all cases;
1517 # it may depend on if -dropdown is true; I've added as a trial
Moshe Zadka22710822001-03-21 17:24:49 +00001518 self.subwidget_list['slistbox'] = _dummyScrolledListBox(self,
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001519 'slistbox',
1520 destroy_physically=0)
Moshe Zadka22710822001-03-21 17:24:49 +00001521 self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox',
1522 destroy_physically=0)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001523
1524class _dummyDirList(DirList, TixSubWidget):
1525 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001526 TixSubWidget.__init__(self, master, name, destroy_physically)
1527 self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
1528 self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
1529 self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001530
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001531class _dummyDirSelectBox(DirSelectBox, TixSubWidget):
1532 def __init__(self, master, name, destroy_physically=1):
1533 TixSubWidget.__init__(self, master, name, destroy_physically)
1534 self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist')
1535 self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx')
1536
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001537class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget):
1538 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001539 TixSubWidget.__init__(self, master, name, destroy_physically)
1540 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
1541 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
1542 self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden')
1543 self.subwidget_list['types'] = _dummyComboBox(self, 'types')
1544 self.subwidget_list['dir'] = _dummyComboBox(self, 'dir')
1545 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
1546 self.subwidget_list['file'] = _dummyComboBox(self, 'file')
1547 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001548
1549class _dummyFileSelectBox(FileSelectBox, TixSubWidget):
1550 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001551 TixSubWidget.__init__(self, master, name, destroy_physically)
1552 self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist')
1553 self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
1554 self.subwidget_list['filter'] = _dummyComboBox(self, 'filter')
1555 self.subwidget_list['selection'] = _dummyComboBox(self, 'selection')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001556
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001557class _dummyFileComboBox(ComboBox, TixSubWidget):
1558 def __init__(self, master, name, destroy_physically=1):
1559 TixSubWidget.__init__(self, master, name, destroy_physically)
1560 self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx')
1561
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001562class _dummyStdButtonBox(StdButtonBox, TixSubWidget):
1563 def __init__(self, master, name, destroy_physically=1):
Moshe Zadka22710822001-03-21 17:24:49 +00001564 TixSubWidget.__init__(self, master, name, destroy_physically)
1565 self.subwidget_list['ok'] = _dummyButton(self, 'ok')
1566 self.subwidget_list['apply'] = _dummyButton(self, 'apply')
1567 self.subwidget_list['cancel'] = _dummyButton(self, 'cancel')
1568 self.subwidget_list['help'] = _dummyButton(self, 'help')
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001569
1570class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget):
1571 def __init__(self, master, name, destroy_physically=0):
Moshe Zadka22710822001-03-21 17:24:49 +00001572 TixSubWidget.__init__(self, master, name, destroy_physically)
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001573
1574########################
1575### Utility Routines ###
1576########################
1577
1578# Returns the qualified path name for the widget. Normally used to set
1579# default options for subwidgets. See tixwidgets.py
1580def OptionName(widget):
1581 return widget.tk.call('tixOptionName', widget._w)
1582
1583# Called with a dictionary argument of the form
1584# {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'}
1585# returns a string which can be used to configure the fsbox file types
1586# in an ExFileSelectBox. i.e.,
1587# '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}'
1588def FileTypeList(dict):
1589 s = ''
1590 for type in dict.keys():
Moshe Zadka22710822001-03-21 17:24:49 +00001591 s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} '
Martin v. Löwisb21cb5f2001-03-21 07:42:07 +00001592 return s
1593
Martin v. Löwisb7b32602001-11-02 23:48:20 +00001594# Still to be done:
1595class CObjView(TixWidget):
1596 """This file implements the Canvas Object View widget. This is a base
1597 class of IconView. It implements automatic placement/adjustment of the
1598 scrollbars according to the canvas objects inside the canvas subwidget.
1599 The scrollbars are adjusted so that the canvas is just large enough
1600 to see all the objects.
1601 """
1602 pass
1603