Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1 | # -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 2 | # |
| 3 | # $Id$ |
| 4 | # |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 5 | # Tix.py -- Tix widget wrappers. |
| 6 | # |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 7 | # For Tix, see http://tix.sourceforge.net |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 8 | # |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 9 | # - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 10 | # based on an idea of Jean-Marc Lugrin (lugrin@ms.com) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 11 | # |
| 12 | # NOTE: In order to minimize changes to Tkinter.py, some of the code here |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 13 | # (TixWidget.__init__) has been taken from Tkinter (Widget.__init__) |
| 14 | # and will break if there are major changes in Tkinter. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 15 | # |
| 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 Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 20 | # w.ok['text'] = 'Who Cares' |
| 21 | # or w.ok['bg'] = w['bg'] |
| 22 | # or even w.ok.invoke() |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 23 | # etc. |
| 24 | # |
| 25 | # Compare the demo tixwidgets.py to the original Tcl program and you will |
| 26 | # appreciate the advantages. |
| 27 | # |
| 28 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 29 | from Tkinter import * |
| 30 | from Tkinter import _flatten, _cnfmerge, _default_root |
| 31 | |
| 32 | # WARNING - TkVersion is a limited precision floating point number |
| 33 | if TkVersion < 3.999: |
| 34 | raise ImportError, "This version of Tix.py requires Tk 4.0 or higher" |
| 35 | |
| 36 | import _tkinter # If this fails your Python may not be configured for Tk |
Neal Norwitz | ebb4190 | 2002-05-31 20:51:31 +0000 | [diff] [blame] | 37 | # TixVersion = float(tkinter.TIX_VERSION) # If this fails your Python may not be configured for Tix |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 38 | # WARNING - TixVersion is a limited precision floating point number |
| 39 | |
| 40 | # Some more constants (for consistency with Tkinter) |
| 41 | WINDOW = 'window' |
| 42 | TEXT = 'text' |
| 43 | STATUS = 'status' |
| 44 | IMMEDIATE = 'immediate' |
| 45 | IMAGE = 'image' |
| 46 | IMAGETEXT = 'imagetext' |
| 47 | BALLOON = 'balloon' |
| 48 | AUTO = 'auto' |
| 49 | ACROSSTOP = 'acrosstop' |
| 50 | |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 51 | # Some constants used by Tkinter dooneevent() |
| 52 | TCL_DONT_WAIT = 1 << 1 |
| 53 | TCL_WINDOW_EVENTS = 1 << 2 |
| 54 | TCL_FILE_EVENTS = 1 << 3 |
| 55 | TCL_TIMER_EVENTS = 1 << 4 |
| 56 | TCL_IDLE_EVENTS = 1 << 5 |
| 57 | TCL_ALL_EVENTS = 0 |
| 58 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 59 | # BEWARE - this is implemented by copying some code from the Widget class |
| 60 | # in Tkinter (to override Widget initialization) and is therefore |
| 61 | # liable to break. |
| 62 | import Tkinter, os |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 63 | |
| 64 | # Could probably add this to Tkinter.Misc |
| 65 | class tixCommand: |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 66 | """The tix commands provide access to miscellaneous elements |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 67 | of Tix's internal state and the Tix application context. |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 68 | Most of the information manipulated by these commands pertains |
| 69 | to the application as a whole, or to a screen or |
| 70 | display, rather than to a particular window. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 71 | |
| 72 | This is a mixin class, assumed to be mixed to Tkinter.Tk |
| 73 | that supports the self.tk.call method. |
| 74 | """ |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 75 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 76 | def tix_addbitmapdir(self, directory): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 77 | """Tix maintains a list of directories under which |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 78 | the tix_getimage and tix_getbitmap commands will |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 79 | search for image files. The standard bitmap directory |
| 80 | is $TIX_LIBRARY/bitmaps. The addbitmapdir command |
| 81 | adds directory into this list. By using this |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 82 | command, the image files of an applications can |
| 83 | also be located using the tix_getimage or tix_getbitmap |
| 84 | command. |
| 85 | """ |
| 86 | return self.tk.call('tix', 'addbitmapdir', directory) |
| 87 | |
| 88 | def tix_cget(self, option): |
| 89 | """Returns the current value of the configuration |
| 90 | option given by option. Option may be any of the |
| 91 | options described in the CONFIGURATION OPTIONS section. |
| 92 | """ |
| 93 | return self.tk.call('tix', 'cget', option) |
| 94 | |
| 95 | def tix_configure(self, cnf=None, **kw): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 96 | """Query or modify the configuration options of the Tix application |
| 97 | context. If no option is specified, returns a dictionary all of the |
| 98 | available options. If option is specified with no value, then the |
| 99 | command returns a list describing the one named option (this list |
| 100 | will be identical to the corresponding sublist of the value |
| 101 | returned if no option is specified). If one or more option-value |
| 102 | pairs are specified, then the command modifies the given option(s) |
| 103 | to have the given value(s); in this case the command returns an |
| 104 | empty string. Option may be any of the configuration options. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 105 | """ |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 106 | # Copied from Tkinter.py |
| 107 | if kw: |
| 108 | cnf = _cnfmerge((cnf, kw)) |
| 109 | elif cnf: |
| 110 | cnf = _cnfmerge(cnf) |
| 111 | if cnf is None: |
| 112 | cnf = {} |
| 113 | for x in self.tk.split(self.tk.call('tix', 'configure')): |
| 114 | cnf[x[0][1:]] = (x[0][1:],) + x[1:] |
| 115 | return cnf |
| 116 | if isinstance(cnf, StringType): |
| 117 | x = self.tk.split(self.tk.call('tix', 'configure', '-'+cnf)) |
| 118 | return (x[0][1:],) + x[1:] |
| 119 | return self.tk.call(('tix', 'configure') + self._options(cnf)) |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 120 | |
| 121 | def tix_filedialog(self, dlgclass=None): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 122 | """Returns the file selection dialog that may be shared among |
| 123 | different calls from this application. This command will create a |
| 124 | file selection dialog widget when it is called the first time. This |
| 125 | dialog will be returned by all subsequent calls to tix_filedialog. |
| 126 | An optional dlgclass parameter can be passed to specified what type |
| 127 | of file selection dialog widget is desired. Possible options are |
| 128 | tix FileSelectDialog or tixExFileSelectDialog. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 129 | """ |
| 130 | if dlgclass is not None: |
| 131 | return self.tk.call('tix', 'filedialog', dlgclass) |
| 132 | else: |
| 133 | return self.tk.call('tix', 'filedialog') |
| 134 | |
| 135 | def tix_getbitmap(self, name): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 136 | """Locates a bitmap file of the name name.xpm or name in one of the |
| 137 | bitmap directories (see the tix_addbitmapdir command above). By |
| 138 | using tix_getbitmap, you can avoid hard coding the pathnames of the |
| 139 | bitmap files in your application. When successful, it returns the |
| 140 | complete pathname of the bitmap file, prefixed with the character |
| 141 | '@'. The returned value can be used to configure the -bitmap |
| 142 | option of the TK and Tix widgets. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 143 | """ |
| 144 | return self.tk.call('tix', 'getbitmap', name) |
| 145 | |
| 146 | def tix_getimage(self, name): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 147 | """Locates an image file of the name name.xpm, name.xbm or name.ppm |
| 148 | in one of the bitmap directories (see the addbitmapdir command |
| 149 | above). If more than one file with the same name (but different |
| 150 | extensions) exist, then the image type is chosen according to the |
| 151 | depth of the X display: xbm images are chosen on monochrome |
| 152 | displays and color images are chosen on color displays. By using |
| 153 | tix_ getimage, you can advoid hard coding the pathnames of the |
| 154 | image files in your application. When successful, this command |
| 155 | returns the name of the newly created image, which can be used to |
| 156 | configure the -image option of the Tk and Tix widgets. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 157 | """ |
| 158 | return self.tk.call('tix', 'getimage', name) |
| 159 | |
| 160 | def tix_option_get(self, name): |
| 161 | """Gets the options manitained by the Tix |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 162 | scheme mechanism. Available options include: |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 163 | |
| 164 | active_bg active_fg bg |
| 165 | bold_font dark1_bg dark1_fg |
| 166 | dark2_bg dark2_fg disabled_fg |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 167 | fg fixed_font font |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 168 | inactive_bg inactive_fg input1_bg |
| 169 | input2_bg italic_font light1_bg |
| 170 | light1_fg light2_bg light2_fg |
| 171 | menu_font output1_bg output2_bg |
| 172 | select_bg select_fg selector |
| 173 | """ |
| 174 | # could use self.tk.globalgetvar('tixOption', name) |
| 175 | return self.tk.call('tix', 'option', 'get', name) |
| 176 | |
| 177 | def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None): |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 178 | """Resets the scheme and fontset of the Tix application to |
| 179 | newScheme and newFontSet, respectively. This affects only those |
| 180 | widgets created after this call. Therefore, it is best to call the |
| 181 | resetoptions command before the creation of any widgets in a Tix |
| 182 | application. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 183 | |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 184 | The optional parameter newScmPrio can be given to reset the |
| 185 | priority level of the Tk options set by the Tix schemes. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 186 | |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 187 | Because of the way Tk handles the X option database, after Tix has |
| 188 | been has imported and inited, it is not possible to reset the color |
| 189 | schemes and font sets using the tix config command. Instead, the |
| 190 | tix_resetoptions command must be used. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 191 | """ |
| 192 | if newScmPrio is not None: |
| 193 | return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio) |
| 194 | else: |
| 195 | return self.tk.call('tix', 'resetoptions', newScheme, newFontSet) |
| 196 | |
| 197 | class Tk(Tkinter.Tk, tixCommand): |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 198 | """Toplevel widget of Tix which represents mostly the main window |
| 199 | of an application. It has an associated Tcl interpreter.""" |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 200 | def __init__(self, screenName=None, baseName=None, className='Tix'): |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 201 | Tkinter.Tk.__init__(self, screenName, baseName, className) |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 202 | tixlib = os.environ.get('TIX_LIBRARY') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 203 | self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]') |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 204 | if tixlib is not None: |
| 205 | self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) |
| 206 | self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 207 | # Load Tix - this should work dynamically or statically |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 208 | # If it's static, lib/tix8.1/pkgIndex.tcl should have |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 209 | # 'load {} Tix' |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 210 | # If it's dynamic under Unix, lib/tix8.1/pkgIndex.tcl should have |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 211 | # 'load libtix8.1.8.3.so Tix' |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 212 | self.tk.eval('package require Tix') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 213 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 214 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 215 | # The Tix 'tixForm' geometry manager |
| 216 | class Form: |
| 217 | """The Tix Form geometry manager |
| 218 | |
| 219 | Widgets can be arranged by specifying attachments to other widgets. |
| 220 | See Tix documentation for complete details""" |
| 221 | |
| 222 | def config(self, cnf={}, **kw): |
| 223 | apply(self.tk.call, ('tixForm', self._w) + self._options(cnf, kw)) |
| 224 | |
| 225 | form = config |
| 226 | |
| 227 | def __setitem__(self, key, value): |
Guido van Rossum | 49fa2bd | 2001-08-13 14:12:35 +0000 | [diff] [blame] | 228 | Form.form(self, {key: value}) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 229 | |
| 230 | def check(self): |
| 231 | return self.tk.call('tixForm', 'check', self._w) |
| 232 | |
| 233 | def forget(self): |
| 234 | self.tk.call('tixForm', 'forget', self._w) |
| 235 | |
| 236 | def grid(self, xsize=0, ysize=0): |
| 237 | if (not xsize) and (not ysize): |
| 238 | x = self.tk.call('tixForm', 'grid', self._w) |
| 239 | y = self.tk.splitlist(x) |
| 240 | z = () |
| 241 | for x in y: |
| 242 | z = z + (self.tk.getint(x),) |
| 243 | return z |
| 244 | self.tk.call('tixForm', 'grid', self._w, xsize, ysize) |
| 245 | |
| 246 | def info(self, option=None): |
| 247 | if not option: |
| 248 | return self.tk.call('tixForm', 'info', self._w) |
| 249 | if option[0] != '-': |
| 250 | option = '-' + option |
| 251 | return self.tk.call('tixForm', 'info', self._w, option) |
| 252 | |
| 253 | def slaves(self): |
| 254 | return map(self._nametowidget, |
| 255 | self.tk.splitlist( |
| 256 | self.tk.call( |
| 257 | 'tixForm', 'slaves', self._w))) |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 258 | |
| 259 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 260 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 261 | |
| 262 | Tkinter.Widget.__bases__ = Tkinter.Widget.__bases__ + (Form,) |
| 263 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 264 | class TixWidget(Tkinter.Widget): |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 265 | """A TixWidget class is used to package all (or most) Tix widgets. |
| 266 | |
| 267 | Widget initialization is extended in two ways: |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 268 | 1) It is possible to give a list of options which must be part of |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 269 | the creation command (so called Tix 'static' options). These cannot be |
| 270 | given as a 'config' command later. |
| 271 | 2) It is possible to give the name of an existing TK widget. These are |
| 272 | child widgets created automatically by a Tix mega-widget. The Tk call |
| 273 | to create these widgets is therefore bypassed in TixWidget.__init__ |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 274 | |
| 275 | Both options are for use by subclasses only. |
| 276 | """ |
| 277 | def __init__ (self, master=None, widgetName=None, |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 278 | static_options=None, cnf={}, kw={}): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 279 | # Merge keywords and dictionary arguments |
| 280 | if kw: |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 281 | cnf = _cnfmerge((cnf, kw)) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 282 | else: |
| 283 | cnf = _cnfmerge(cnf) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 284 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 285 | # Move static options into extra. static_options must be |
| 286 | # a list of keywords (or None). |
| 287 | extra=() |
| 288 | if static_options: |
| 289 | for k,v in cnf.items()[:]: |
| 290 | if k in static_options: |
| 291 | extra = extra + ('-' + k, v) |
| 292 | del cnf[k] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 293 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 294 | self.widgetName = widgetName |
| 295 | Widget._setup(self, master, cnf) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 296 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 297 | # If widgetName is None, this is a dummy creation call where the |
| 298 | # corresponding Tk widget has already been created by Tix |
| 299 | if widgetName: |
| 300 | apply(self.tk.call, (widgetName, self._w) + extra) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 301 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 302 | # Non-static options - to be done via a 'config' command |
| 303 | if cnf: |
| 304 | Widget.config(self, cnf) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 305 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 306 | # Dictionary to hold subwidget names for easier access. We can't |
| 307 | # use the children list because the public Tix names may not be the |
| 308 | # same as the pathname component |
| 309 | self.subwidget_list = {} |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 310 | |
| 311 | # We set up an attribute access function so that it is possible to |
| 312 | # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello' |
| 313 | # when w is a StdButtonBox. |
| 314 | # We can even do w.ok.invoke() because w.ok is subclassed from the |
| 315 | # Button class if you go through the proper constructors |
| 316 | def __getattr__(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 317 | if self.subwidget_list.has_key(name): |
| 318 | return self.subwidget_list[name] |
| 319 | raise AttributeError, name |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 320 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 321 | def set_silent(self, value): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 322 | """Set a variable without calling its action routine""" |
| 323 | self.tk.call('tixSetSilent', self._w, value) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 324 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 325 | def subwidget(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 326 | """Return the named subwidget (which must have been created by |
| 327 | the sub-class).""" |
| 328 | n = self._subwidget_name(name) |
| 329 | if not n: |
| 330 | raise TclError, "Subwidget " + name + " not child of " + self._name |
| 331 | # Remove header of name and leading dot |
| 332 | n = n[len(self._w)+1:] |
| 333 | return self._nametowidget(n) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 334 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 335 | def subwidgets_all(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 336 | """Return all subwidgets.""" |
| 337 | names = self._subwidget_names() |
| 338 | if not names: |
| 339 | return [] |
| 340 | retlist = [] |
| 341 | for name in names: |
| 342 | name = name[len(self._w)+1:] |
| 343 | try: |
| 344 | retlist.append(self._nametowidget(name)) |
| 345 | except: |
| 346 | # some of the widgets are unknown e.g. border in LabelFrame |
| 347 | pass |
| 348 | return retlist |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 349 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 350 | def _subwidget_name(self,name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 351 | """Get a subwidget name (returns a String, not a Widget !)""" |
| 352 | try: |
| 353 | return self.tk.call(self._w, 'subwidget', name) |
| 354 | except TclError: |
| 355 | return None |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 356 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 357 | def _subwidget_names(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 358 | """Return the name of all subwidgets.""" |
| 359 | try: |
| 360 | x = self.tk.call(self._w, 'subwidgets', '-all') |
| 361 | return self.tk.split(x) |
| 362 | except TclError: |
| 363 | return None |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 364 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 365 | def config_all(self, option, value): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 366 | """Set configuration options for all subwidgets (and self).""" |
| 367 | if option == '': |
| 368 | return |
| 369 | elif not isinstance(option, StringType): |
| 370 | option = `option` |
| 371 | if not isinstance(value, StringType): |
| 372 | value = `value` |
| 373 | names = self._subwidget_names() |
| 374 | for name in names: |
| 375 | self.tk.call(name, 'configure', '-' + option, value) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 376 | |
| 377 | # Subwidgets are child widgets created automatically by mega-widgets. |
| 378 | # In python, we have to create these subwidgets manually to mirror their |
| 379 | # existence in Tk/Tix. |
| 380 | class TixSubWidget(TixWidget): |
| 381 | """Subwidget class. |
| 382 | |
| 383 | This is used to mirror child widgets automatically created |
| 384 | by Tix/Tk as part of a mega-widget in Python (which is not informed |
| 385 | of this)""" |
| 386 | |
| 387 | def __init__(self, master, name, |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 388 | destroy_physically=1, check_intermediate=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 389 | if check_intermediate: |
| 390 | path = master._subwidget_name(name) |
| 391 | try: |
| 392 | path = path[len(master._w)+1:] |
Neal Norwitz | ebb4190 | 2002-05-31 20:51:31 +0000 | [diff] [blame] | 393 | plist = path.split('.') |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 394 | except: |
| 395 | plist = [] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 396 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 397 | if (not check_intermediate) or len(plist) < 2: |
| 398 | # immediate descendant |
| 399 | TixWidget.__init__(self, master, None, None, {'name' : name}) |
| 400 | else: |
| 401 | # Ensure that the intermediate widgets exist |
| 402 | parent = master |
| 403 | for i in range(len(plist) - 1): |
Neal Norwitz | ebb4190 | 2002-05-31 20:51:31 +0000 | [diff] [blame] | 404 | n = '.'.join(plist[:i+1]) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 405 | try: |
| 406 | w = master._nametowidget(n) |
| 407 | parent = w |
| 408 | except KeyError: |
| 409 | # Create the intermediate widget |
| 410 | parent = TixSubWidget(parent, plist[i], |
| 411 | destroy_physically=0, |
| 412 | check_intermediate=0) |
| 413 | TixWidget.__init__(self, parent, None, None, {'name' : name}) |
| 414 | self.destroy_physically = destroy_physically |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 415 | |
| 416 | def destroy(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 417 | # For some widgets e.g., a NoteBook, when we call destructors, |
| 418 | # we must be careful not to destroy the frame widget since this |
| 419 | # also destroys the parent NoteBook thus leading to an exception |
| 420 | # in Tkinter when it finally calls Tcl to destroy the NoteBook |
| 421 | for c in self.children.values(): c.destroy() |
| 422 | if self.master.children.has_key(self._name): |
| 423 | del self.master.children[self._name] |
| 424 | if self.master.subwidget_list.has_key(self._name): |
| 425 | del self.master.subwidget_list[self._name] |
| 426 | if self.destroy_physically: |
| 427 | # This is bypassed only for a few widgets |
| 428 | self.tk.call('destroy', self._w) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 429 | |
| 430 | |
| 431 | # Useful func. to split Tcl lists and return as a dict. From Tkinter.py |
| 432 | def _lst2dict(lst): |
| 433 | dict = {} |
| 434 | for x in lst: |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 435 | dict[x[0][1:]] = (x[0][1:],) + x[1:] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 436 | return dict |
| 437 | |
| 438 | # Useful class to create a display style - later shared by many items. |
| 439 | # Contributed by Steffen Kremser |
| 440 | class DisplayStyle: |
| 441 | """DisplayStyle - handle configuration options shared by |
| 442 | (multiple) Display Items""" |
| 443 | |
| 444 | def __init__(self, itemtype, cnf={}, **kw ): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 445 | master = _default_root # global from Tkinter |
| 446 | if not master and cnf.has_key('refwindow'): master=cnf['refwindow'] |
| 447 | elif not master and kw.has_key('refwindow'): master= kw['refwindow'] |
| 448 | elif not master: raise RuntimeError, "Too early to create display style: no root window" |
| 449 | self.tk = master.tk |
| 450 | self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + |
| 451 | self._options(cnf,kw) ) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 452 | |
| 453 | def __str__(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 454 | return self.stylename |
| 455 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 456 | def _options(self, cnf, kw ): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 457 | if kw and cnf: |
| 458 | cnf = _cnfmerge((cnf, kw)) |
| 459 | elif kw: |
| 460 | cnf = kw |
| 461 | opts = () |
| 462 | for k, v in cnf.items(): |
| 463 | opts = opts + ('-'+k, v) |
| 464 | return opts |
| 465 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 466 | def delete(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 467 | self.tk.call(self.stylename, 'delete') |
| 468 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 469 | def __setitem__(self,key,value): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 470 | self.tk.call(self.stylename, 'configure', '-%s'%key, value) |
| 471 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 472 | def config(self, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 473 | return _lst2dict( |
| 474 | self.tk.split( |
| 475 | apply(self.tk.call, |
| 476 | (self.stylename, 'configure') + self._options(cnf,kw)))) |
| 477 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 478 | def __getitem__(self,key): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 479 | return self.tk.call(self.stylename, 'cget', '-%s'%key) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 480 | |
| 481 | |
| 482 | ###################################################### |
| 483 | ### The Tix Widget classes - in alphabetical order ### |
| 484 | ###################################################### |
| 485 | |
| 486 | class Balloon(TixWidget): |
| 487 | """Balloon help widget. |
| 488 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 489 | Subwidget Class |
| 490 | --------- ----- |
Fred Drake | 723293c | 2001-12-13 04:53:07 +0000 | [diff] [blame] | 491 | label Label |
| 492 | message Message""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 493 | |
| 494 | def __init__(self, master=None, cnf={}, **kw): |
Martin v. Löwis | 652e191 | 2001-11-25 14:50:56 +0000 | [diff] [blame] | 495 | # static seem to be -installcolormap -initwait -statusbar -cursor |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 496 | static = ['options', 'installcolormap', 'initwait', 'statusbar', |
| 497 | 'cursor'] |
| 498 | TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw) |
| 499 | self.subwidget_list['label'] = _dummyLabel(self, 'label', |
| 500 | destroy_physically=0) |
| 501 | self.subwidget_list['message'] = _dummyLabel(self, 'message', |
| 502 | destroy_physically=0) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 503 | |
| 504 | def bind_widget(self, widget, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 505 | """Bind balloon widget to another. |
| 506 | One balloon widget may be bound to several widgets at the same time""" |
| 507 | apply(self.tk.call, |
| 508 | (self._w, 'bind', widget._w) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 509 | |
| 510 | def unbind_widget(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 511 | self.tk.call(self._w, 'unbind', widget._w) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 512 | |
| 513 | class ButtonBox(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 514 | """ButtonBox - A container for pushbuttons. |
| 515 | Subwidgets are the buttons added with the add method. |
| 516 | """ |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 517 | def __init__(self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 518 | TixWidget.__init__(self, master, 'tixButtonBox', |
| 519 | ['orientation', 'options'], cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 520 | |
| 521 | def add(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 522 | """Add a button with given name to box.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 523 | |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 524 | btn = apply(self.tk.call, |
| 525 | (self._w, 'add', name) + self._options(cnf, kw)) |
| 526 | self.subwidget_list[name] = _dummyButton(self, name) |
| 527 | return btn |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 528 | |
| 529 | def invoke(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 530 | if self.subwidget_list.has_key(name): |
| 531 | self.tk.call(self._w, 'invoke', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 532 | |
| 533 | class ComboBox(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 534 | """ComboBox - an Entry field with a dropdown menu. The user can select a |
| 535 | choice by either typing in the entry subwdget or selecting from the |
| 536 | listbox subwidget. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 537 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 538 | Subwidget Class |
| 539 | --------- ----- |
| 540 | entry Entry |
| 541 | arrow Button |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 542 | slistbox ScrolledListBox |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 543 | tick Button |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 544 | cross Button : present if created with the fancy option""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 545 | |
| 546 | def __init__ (self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 547 | TixWidget.__init__(self, master, 'tixComboBox', |
| 548 | ['editable', 'dropdown', 'fancy', 'options'], |
| 549 | cnf, kw) |
| 550 | self.subwidget_list['label'] = _dummyLabel(self, 'label') |
| 551 | self.subwidget_list['entry'] = _dummyEntry(self, 'entry') |
| 552 | self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') |
| 553 | self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, |
| 554 | 'slistbox') |
| 555 | try: |
| 556 | self.subwidget_list['tick'] = _dummyButton(self, 'tick') |
| 557 | self.subwidget_list['cross'] = _dummyButton(self, 'cross') |
| 558 | except TypeError: |
| 559 | # unavailable when -fancy not specified |
| 560 | pass |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 561 | |
| 562 | def add_history(self, str): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 563 | self.tk.call(self._w, 'addhistory', str) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 564 | |
| 565 | def append_history(self, str): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 566 | self.tk.call(self._w, 'appendhistory', str) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 567 | |
| 568 | def insert(self, index, str): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 569 | self.tk.call(self._w, 'insert', index, str) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 570 | |
| 571 | def pick(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 572 | self.tk.call(self._w, 'pick', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 573 | |
| 574 | class Control(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 575 | """Control - An entry field with value change arrows. The user can |
| 576 | adjust the value by pressing the two arrow buttons or by entering |
| 577 | the value directly into the entry. The new value will be checked |
| 578 | against the user-defined upper and lower limits. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 579 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 580 | Subwidget Class |
| 581 | --------- ----- |
| 582 | incr Button |
| 583 | decr Button |
| 584 | entry Entry |
| 585 | label Label""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 586 | |
| 587 | def __init__ (self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 588 | TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) |
| 589 | self.subwidget_list['incr'] = _dummyButton(self, 'incr') |
| 590 | self.subwidget_list['decr'] = _dummyButton(self, 'decr') |
| 591 | self.subwidget_list['label'] = _dummyLabel(self, 'label') |
| 592 | self.subwidget_list['entry'] = _dummyEntry(self, 'entry') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 593 | |
| 594 | def decrement(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 595 | self.tk.call(self._w, 'decr') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 596 | |
| 597 | def increment(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 598 | self.tk.call(self._w, 'incr') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 599 | |
| 600 | def invoke(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 601 | self.tk.call(self._w, 'invoke') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 602 | |
| 603 | def update(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 604 | self.tk.call(self._w, 'update') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 605 | |
| 606 | class DirList(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 607 | """DirList - displays a list view of a directory, its previous |
| 608 | directories and its sub-directories. The user can choose one of |
| 609 | the directories displayed in the list or change to another directory. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 610 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 611 | Subwidget Class |
| 612 | --------- ----- |
| 613 | hlist HList |
| 614 | hsb Scrollbar |
| 615 | vsb Scrollbar""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 616 | |
| 617 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 618 | TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) |
| 619 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 620 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 621 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 622 | |
| 623 | def chdir(self, dir): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 624 | self.tk.call(self._w, 'chdir', dir) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 625 | |
| 626 | class DirTree(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 627 | """DirTree - Directory Listing in a hierarchical view. |
| 628 | Displays a tree view of a directory, its previous directories and its |
| 629 | sub-directories. The user can choose one of the directories displayed |
| 630 | in the list or change to another directory. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 631 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 632 | Subwidget Class |
| 633 | --------- ----- |
| 634 | hlist HList |
| 635 | hsb Scrollbar |
| 636 | vsb Scrollbar""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 637 | |
| 638 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 639 | TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) |
| 640 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 641 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 642 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 643 | |
| 644 | def chdir(self, dir): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 645 | self.tk.call(self._w, 'chdir', dir) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 646 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 647 | class DirSelectBox(TixWidget): |
| 648 | """DirSelectBox - Motif style file select box. |
| 649 | It is generally used for |
| 650 | the user to choose a file. FileSelectBox stores the files mostly |
| 651 | recently selected into a ComboBox widget so that they can be quickly |
| 652 | selected again. |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 653 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 654 | Subwidget Class |
| 655 | --------- ----- |
| 656 | selection ComboBox |
| 657 | filter ComboBox |
| 658 | dirlist ScrolledListBox |
| 659 | filelist ScrolledListBox""" |
| 660 | |
| 661 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 662 | TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw) |
| 663 | self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') |
| 664 | self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 665 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 666 | class ExFileSelectBox(TixWidget): |
| 667 | """ExFileSelectBox - MS Windows style file select box. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 668 | It provides an convenient method for the user to select files. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 669 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 670 | Subwidget Class |
| 671 | --------- ----- |
| 672 | cancel Button |
| 673 | ok Button |
| 674 | hidden Checkbutton |
| 675 | types ComboBox |
| 676 | dir ComboBox |
| 677 | file ComboBox |
| 678 | dirlist ScrolledListBox |
| 679 | filelist ScrolledListBox""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 680 | |
| 681 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 682 | TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) |
| 683 | self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') |
| 684 | self.subwidget_list['ok'] = _dummyButton(self, 'ok') |
| 685 | self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') |
| 686 | self.subwidget_list['types'] = _dummyComboBox(self, 'types') |
| 687 | self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') |
| 688 | self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') |
| 689 | self.subwidget_list['file'] = _dummyComboBox(self, 'file') |
| 690 | self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 691 | |
| 692 | def filter(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 693 | self.tk.call(self._w, 'filter') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 694 | |
| 695 | def invoke(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 696 | self.tk.call(self._w, 'invoke') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 697 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 698 | |
| 699 | # Should inherit from a Dialog class |
| 700 | class DirSelectDialog(TixWidget): |
| 701 | """The DirSelectDialog widget presents the directories in the file |
| 702 | system in a dialog window. The user can use this dialog window to |
| 703 | navigate through the file system to select the desired directory. |
| 704 | |
| 705 | Subwidgets Class |
| 706 | ---------- ----- |
| 707 | dirbox DirSelectDialog""" |
| 708 | |
| 709 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 710 | TixWidget.__init__(self, master, 'tixDirSelectDialog', |
| 711 | ['options'], cnf, kw) |
| 712 | self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox') |
| 713 | # cancel and ok buttons are missing |
| 714 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 715 | def popup(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 716 | self.tk.call(self._w, 'popup') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 717 | |
| 718 | def popdown(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 719 | self.tk.call(self._w, 'popdown') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 720 | |
| 721 | |
| 722 | # Should inherit from a Dialog class |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 723 | class ExFileSelectDialog(TixWidget): |
| 724 | """ExFileSelectDialog - MS Windows style file select dialog. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 725 | It provides an convenient method for the user to select files. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 726 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 727 | Subwidgets Class |
| 728 | ---------- ----- |
| 729 | fsbox ExFileSelectBox""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 730 | |
| 731 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 732 | TixWidget.__init__(self, master, 'tixExFileSelectDialog', |
| 733 | ['options'], cnf, kw) |
| 734 | self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 735 | |
| 736 | def popup(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 737 | self.tk.call(self._w, 'popup') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 738 | |
| 739 | def popdown(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 740 | self.tk.call(self._w, 'popdown') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 741 | |
| 742 | class FileSelectBox(TixWidget): |
| 743 | """ExFileSelectBox - Motif style file select box. |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 744 | It is generally used for |
| 745 | the user to choose a file. FileSelectBox stores the files mostly |
| 746 | recently selected into a ComboBox widget so that they can be quickly |
| 747 | selected again. |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 748 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 749 | Subwidget Class |
| 750 | --------- ----- |
| 751 | selection ComboBox |
| 752 | filter ComboBox |
| 753 | dirlist ScrolledListBox |
| 754 | filelist ScrolledListBox""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 755 | |
| 756 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 757 | TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) |
| 758 | self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') |
| 759 | self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') |
| 760 | self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') |
| 761 | self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 762 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 763 | def apply_filter(self): # name of subwidget is same as command |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 764 | self.tk.call(self._w, 'filter') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 765 | |
| 766 | def invoke(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 767 | self.tk.call(self._w, 'invoke') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 768 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 769 | # Should inherit from a Dialog class |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 770 | class FileSelectDialog(TixWidget): |
| 771 | """FileSelectDialog - Motif style file select dialog. |
| 772 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 773 | Subwidgets Class |
| 774 | ---------- ----- |
| 775 | btns StdButtonBox |
| 776 | fsbox FileSelectBox""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 777 | |
| 778 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 779 | TixWidget.__init__(self, master, 'tixFileSelectDialog', |
| 780 | ['options'], cnf, kw) |
| 781 | self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') |
| 782 | self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 783 | |
| 784 | def popup(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 785 | self.tk.call(self._w, 'popup') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 786 | |
| 787 | def popdown(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 788 | self.tk.call(self._w, 'popdown') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 789 | |
| 790 | class FileEntry(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 791 | """FileEntry - Entry field with button that invokes a FileSelectDialog. |
| 792 | The user can type in the filename manually. Alternatively, the user can |
| 793 | press the button widget that sits next to the entry, which will bring |
| 794 | up a file selection dialog. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 795 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 796 | Subwidgets Class |
| 797 | ---------- ----- |
| 798 | button Button |
| 799 | entry Entry""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 800 | |
| 801 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 802 | TixWidget.__init__(self, master, 'tixFileEntry', |
| 803 | ['dialogtype', 'options'], cnf, kw) |
| 804 | self.subwidget_list['button'] = _dummyButton(self, 'button') |
| 805 | self.subwidget_list['entry'] = _dummyEntry(self, 'entry') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 806 | |
| 807 | def invoke(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 808 | self.tk.call(self._w, 'invoke') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 809 | |
| 810 | def file_dialog(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 811 | # XXX return python object |
| 812 | pass |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 813 | |
| 814 | class HList(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 815 | """HList - Hierarchy display widget can be used to display any data |
| 816 | that have a hierarchical structure, for example, file system directory |
| 817 | trees. The list entries are indented and connected by branch lines |
| 818 | according to their places in the hierachy. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 819 | |
| 820 | Subwidgets - None""" |
| 821 | |
| 822 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 823 | TixWidget.__init__(self, master, 'tixHList', |
| 824 | ['columns', 'options'], cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 825 | |
| 826 | def add(self, entry, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 827 | return apply(self.tk.call, |
| 828 | (self._w, 'add', entry) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 829 | |
| 830 | def add_child(self, parent=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 831 | if not parent: |
| 832 | parent = '' |
| 833 | return apply(self.tk.call, |
| 834 | (self._w, 'addchild', parent) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 835 | |
| 836 | def anchor_set(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 837 | self.tk.call(self._w, 'anchor', 'set', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 838 | |
| 839 | def anchor_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 840 | self.tk.call(self._w, 'anchor', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 841 | |
| 842 | def column_width(self, col=0, width=None, chars=None): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 843 | if not chars: |
| 844 | return self.tk.call(self._w, 'column', 'width', col, width) |
| 845 | else: |
| 846 | return self.tk.call(self._w, 'column', 'width', col, |
| 847 | '-char', chars) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 848 | |
| 849 | def delete_all(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 850 | self.tk.call(self._w, 'delete', 'all') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 851 | |
| 852 | def delete_entry(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 853 | self.tk.call(self._w, 'delete', 'entry', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 854 | |
| 855 | def delete_offsprings(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 856 | self.tk.call(self._w, 'delete', 'offsprings', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 857 | |
| 858 | def delete_siblings(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 859 | self.tk.call(self._w, 'delete', 'siblings', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 860 | |
| 861 | def dragsite_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 862 | self.tk.call(self._w, 'dragsite', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 863 | |
| 864 | def dragsite_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 865 | self.tk.call(self._w, 'dragsite', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 866 | |
| 867 | def dropsite_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 868 | self.tk.call(self._w, 'dropsite', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 869 | |
| 870 | def dropsite_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 871 | self.tk.call(self._w, 'dropsite', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 872 | |
| 873 | def header_create(self, col, cnf={}, **kw): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 874 | apply(self.tk.call, |
| 875 | (self._w, 'header', 'create', col) + self._options(cnf, kw)) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 876 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 877 | def header_configure(self, col, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 878 | if cnf is None: |
| 879 | return _lst2dict( |
| 880 | self.tk.split( |
| 881 | self.tk.call(self._w, 'header', 'configure', col))) |
| 882 | apply(self.tk.call, (self._w, 'header', 'configure', col) |
| 883 | + self._options(cnf, kw)) |
| 884 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 885 | def header_cget(self, col, opt): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 886 | return self.tk.call(self._w, 'header', 'cget', col, opt) |
| 887 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 888 | def header_exists(self, col): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 889 | return self.tk.call(self._w, 'header', 'exists', col) |
| 890 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 891 | def header_delete(self, col): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 892 | self.tk.call(self._w, 'header', 'delete', col) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 893 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 894 | def header_size(self, col): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 895 | return self.tk.call(self._w, 'header', 'size', col) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 896 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 897 | def hide_entry(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 898 | self.tk.call(self._w, 'hide', 'entry', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 899 | |
| 900 | def indicator_create(self, entry, cnf={}, **kw): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 901 | apply(self.tk.call, |
| 902 | (self._w, 'indicator', 'create', entry) + self._options(cnf, kw)) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 903 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 904 | def indicator_configure(self, entry, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 905 | if cnf is None: |
| 906 | return _lst2dict( |
| 907 | self.tk.split( |
| 908 | self.tk.call(self._w, 'indicator', 'configure', entry))) |
| 909 | apply(self.tk.call, |
| 910 | (self._w, 'indicator', 'configure', entry) + self._options(cnf, kw)) |
| 911 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 912 | def indicator_cget(self, entry, opt): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 913 | return self.tk.call(self._w, 'indicator', 'cget', entry, opt) |
| 914 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 915 | def indicator_exists(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 916 | return self.tk.call (self._w, 'indicator', 'exists', entry) |
| 917 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 918 | def indicator_delete(self, entry): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 919 | self.tk.call(self._w, 'indicator', 'delete', entry) |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 920 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 921 | def indicator_size(self, entry): |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 922 | return self.tk.call(self._w, 'indicator', 'size', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 923 | |
| 924 | def info_anchor(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 925 | return self.tk.call(self._w, 'info', 'anchor') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 926 | |
| 927 | def info_children(self, entry=None): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 928 | c = self.tk.call(self._w, 'info', 'children', entry) |
| 929 | return self.tk.splitlist(c) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 930 | |
| 931 | def info_data(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 932 | return self.tk.call(self._w, 'info', 'data', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 933 | |
| 934 | def info_exists(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 935 | return self.tk.call(self._w, 'info', 'exists', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 936 | |
| 937 | def info_hidden(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 938 | return self.tk.call(self._w, 'info', 'hidden', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 939 | |
| 940 | def info_next(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 941 | return self.tk.call(self._w, 'info', 'next', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 942 | |
| 943 | def info_parent(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 944 | return self.tk.call(self._w, 'info', 'parent', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 945 | |
| 946 | def info_prev(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 947 | return self.tk.call(self._w, 'info', 'prev', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 948 | |
| 949 | def info_selection(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 950 | c = self.tk.call(self._w, 'info', 'selection') |
| 951 | return self.tk.splitlist(c) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 952 | |
Martin v. Löwis | 3e04848 | 2001-10-09 11:50:55 +0000 | [diff] [blame] | 953 | def item_cget(self, entry, col, opt): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 954 | return self.tk.call(self._w, 'item', 'cget', entry, col, opt) |
| 955 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 956 | def item_configure(self, entry, col, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 957 | if cnf is None: |
| 958 | return _lst2dict( |
| 959 | self.tk.split( |
| 960 | self.tk.call(self._w, 'item', 'configure', entry, col))) |
| 961 | apply(self.tk.call, (self._w, 'item', 'configure', entry, col) + |
| 962 | self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 963 | |
| 964 | def item_create(self, entry, col, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 965 | apply(self.tk.call, |
| 966 | (self._w, 'item', 'create', entry, col) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 967 | |
| 968 | def item_exists(self, entry, col): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 969 | return self.tk.call(self._w, 'item', 'exists', entry, col) |
| 970 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 971 | def item_delete(self, entry, col): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 972 | self.tk.call(self._w, 'item', 'delete', entry, col) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 973 | |
| 974 | def nearest(self, y): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 975 | return self.tk.call(self._w, 'nearest', y) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 976 | |
| 977 | def see(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 978 | self.tk.call(self._w, 'see', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 979 | |
| 980 | def selection_clear(self, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 981 | apply(self.tk.call, |
| 982 | (self._w, 'selection', 'clear') + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 983 | |
| 984 | def selection_includes(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 985 | return self.tk.call(self._w, 'selection', 'includes', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 986 | |
| 987 | def selection_set(self, first, last=None): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 988 | self.tk.call(self._w, 'selection', 'set', first, last) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 989 | |
| 990 | def show_entry(self, entry): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 991 | return self.tk.call(self._w, 'show', 'entry', entry) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 992 | |
| 993 | def xview(self, *args): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 994 | apply(self.tk.call, (self._w, 'xview') + args) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 995 | |
| 996 | def yview(self, *args): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 997 | apply(self.tk.call, (self._w, 'yview') + args) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 998 | |
| 999 | class InputOnly(TixWidget): |
| 1000 | """InputOnly - Invisible widget. |
| 1001 | |
| 1002 | Subwidgets - None""" |
| 1003 | |
| 1004 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1005 | TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1006 | |
| 1007 | class LabelEntry(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1008 | """LabelEntry - Entry field with label. Packages an entry widget |
| 1009 | and a label into one mega widget. It can beused be used to simplify |
| 1010 | the creation of ``entry-form'' type of interface. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1011 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1012 | Subwidgets Class |
| 1013 | ---------- ----- |
| 1014 | label Label |
| 1015 | entry Entry""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1016 | |
| 1017 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1018 | TixWidget.__init__(self, master, 'tixLabelEntry', |
| 1019 | ['labelside','options'], cnf, kw) |
| 1020 | self.subwidget_list['label'] = _dummyLabel(self, 'label') |
| 1021 | self.subwidget_list['entry'] = _dummyEntry(self, 'entry') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1022 | |
| 1023 | class LabelFrame(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1024 | """LabelFrame - Labelled Frame container. Packages a frame widget |
| 1025 | and a label into one mega widget. To create widgets inside a |
| 1026 | LabelFrame widget, one creates the new widgets relative to the |
| 1027 | frame subwidget and manage them inside the frame subwidget. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1028 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1029 | Subwidgets Class |
| 1030 | ---------- ----- |
| 1031 | label Label |
| 1032 | frame Frame""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1033 | |
| 1034 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1035 | TixWidget.__init__(self, master, 'tixLabelFrame', |
| 1036 | ['labelside','options'], cnf, kw) |
| 1037 | self.subwidget_list['label'] = _dummyLabel(self, 'label') |
| 1038 | self.subwidget_list['frame'] = _dummyFrame(self, 'frame') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1039 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1040 | |
| 1041 | class ListNoteBook(TixWidget): |
| 1042 | """A ListNoteBook widget is very similar to the TixNoteBook widget: |
| 1043 | it can be used to display many windows in a limited space using a |
| 1044 | notebook metaphor. The notebook is divided into a stack of pages |
| 1045 | (windows). At one time only one of these pages can be shown. |
| 1046 | The user can navigate through these pages by |
| 1047 | choosing the name of the desired page in the hlist subwidget.""" |
| 1048 | |
| 1049 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1050 | TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) |
| 1051 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1052 | self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1053 | |
| 1054 | |
| 1055 | def add(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1056 | apply(self.tk.call, |
| 1057 | (self._w, 'add', name) + self._options(cnf, kw)) |
| 1058 | self.subwidget_list[name] = TixSubWidget(self, name) |
| 1059 | return self.subwidget_list[name] |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1060 | |
| 1061 | def raise_page(self, name): # raise is a python keyword |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1062 | self.tk.call(self._w, 'raise', name) |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1063 | |
| 1064 | class Meter(TixWidget): |
| 1065 | """The Meter widget can be used to show the progress of a background |
| 1066 | job which may take a long time to execute. |
| 1067 | """ |
| 1068 | |
| 1069 | def __init__(self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1070 | TixWidget.__init__(self, master, 'tixMeter', |
| 1071 | ['options'], cnf, kw) |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1072 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1073 | class NoteBook(TixWidget): |
| 1074 | """NoteBook - Multi-page container widget (tabbed notebook metaphor). |
| 1075 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1076 | Subwidgets Class |
| 1077 | ---------- ----- |
| 1078 | nbframe NoteBookFrame |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1079 | <pages> page widgets added dynamically with the add method""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1080 | |
| 1081 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1082 | TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) |
| 1083 | self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', |
| 1084 | destroy_physically=0) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1085 | |
| 1086 | def add(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1087 | apply(self.tk.call, |
| 1088 | (self._w, 'add', name) + self._options(cnf, kw)) |
| 1089 | self.subwidget_list[name] = TixSubWidget(self, name) |
| 1090 | return self.subwidget_list[name] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1091 | |
| 1092 | def delete(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1093 | self.tk.call(self._w, 'delete', name) |
| 1094 | self.subwidget_list[name].destroy() |
| 1095 | del self.subwidget_list[name] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1096 | |
| 1097 | def page(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1098 | return self.subwidget(name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1099 | |
| 1100 | def pages(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1101 | # Can't call subwidgets_all directly because we don't want .nbframe |
| 1102 | names = self.tk.split(self.tk.call(self._w, 'pages')) |
| 1103 | ret = [] |
| 1104 | for x in names: |
| 1105 | ret.append(self.subwidget(x)) |
| 1106 | return ret |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1107 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1108 | def raise_page(self, name): # raise is a python keyword |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1109 | self.tk.call(self._w, 'raise', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1110 | |
| 1111 | def raised(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1112 | return self.tk.call(self._w, 'raised') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1113 | |
| 1114 | class NoteBookFrame(TixWidget): |
| 1115 | """Will be added when Tix documentation is available !!!""" |
| 1116 | pass |
| 1117 | |
| 1118 | class OptionMenu(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1119 | """OptionMenu - creates a menu button of options. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1120 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1121 | Subwidget Class |
| 1122 | --------- ----- |
| 1123 | menubutton Menubutton |
| 1124 | menu Menu""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1125 | |
| 1126 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1127 | TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw) |
| 1128 | self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') |
| 1129 | self.subwidget_list['menu'] = _dummyMenu(self, 'menu') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1130 | |
| 1131 | def add_command(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1132 | apply(self.tk.call, |
| 1133 | (self._w, 'add', 'command', name) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1134 | |
| 1135 | def add_separator(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1136 | apply(self.tk.call, |
| 1137 | (self._w, 'add', 'separator', name) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1138 | |
| 1139 | def delete(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1140 | self.tk.call(self._w, 'delete', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1141 | |
| 1142 | def disable(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1143 | self.tk.call(self._w, 'disable', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1144 | |
| 1145 | def enable(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1146 | self.tk.call(self._w, 'enable', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1147 | |
| 1148 | class PanedWindow(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1149 | """PanedWindow - Multi-pane container widget |
| 1150 | allows the user to interactively manipulate the sizes of several |
| 1151 | panes. The panes can be arranged either vertically or horizontally.The |
| 1152 | user changes the sizes of the panes by dragging the resize handle |
| 1153 | between two panes. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1154 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1155 | Subwidgets Class |
| 1156 | ---------- ----- |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1157 | <panes> g/p widgets added dynamically with the add method.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1158 | |
| 1159 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1160 | TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1161 | |
| 1162 | def add(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1163 | apply(self.tk.call, |
| 1164 | (self._w, 'add', name) + self._options(cnf, kw)) |
| 1165 | self.subwidget_list[name] = TixSubWidget(self, name, |
| 1166 | check_intermediate=0) |
| 1167 | return self.subwidget_list[name] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1168 | |
| 1169 | def panes(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1170 | names = self.tk.call(self._w, 'panes') |
| 1171 | ret = [] |
| 1172 | for x in names: |
| 1173 | ret.append(self.subwidget(x)) |
| 1174 | return ret |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1175 | |
| 1176 | class PopupMenu(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1177 | """PopupMenu widget can be used as a replacement of the tk_popup command. |
| 1178 | The advantage of the Tix PopupMenu widget is it requires less application |
| 1179 | code to manipulate. |
| 1180 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1181 | |
Moshe Zadka | 2271082 | 2001-03-21 17:24:49 +0000 | [diff] [blame] | 1182 | Subwidgets Class |
| 1183 | ---------- ----- |
| 1184 | menubutton Menubutton |
| 1185 | menu Menu""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1186 | |
| 1187 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1188 | TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw) |
| 1189 | self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') |
| 1190 | self.subwidget_list['menu'] = _dummyMenu(self, 'menu') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1191 | |
| 1192 | def bind_widget(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1193 | self.tk.call(self._w, 'bind', widget._w) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1194 | |
| 1195 | def unbind_widget(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1196 | self.tk.call(self._w, 'unbind', widget._w) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1197 | |
| 1198 | def post_widget(self, widget, x, y): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1199 | self.tk.call(self._w, 'post', widget._w, x, y) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1200 | |
| 1201 | class ResizeHandle(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1202 | """Internal widget to draw resize handles on Scrolled widgets.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1203 | |
| 1204 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1205 | # There seems to be a Tix bug rejecting the configure method |
| 1206 | # Let's try making the flags -static |
| 1207 | flags = ['options', 'command', 'cursorfg', 'cursorbg', |
| 1208 | 'handlesize', 'hintcolor', 'hintwidth', |
| 1209 | 'x', 'y'] |
| 1210 | # In fact, x y height width are configurable |
| 1211 | TixWidget.__init__(self, master, 'tixResizeHandle', |
| 1212 | flags, cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1213 | |
| 1214 | def attach_widget(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1215 | self.tk.call(self._w, 'attachwidget', widget._w) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1216 | |
Martin v. Löwis | 652e191 | 2001-11-25 14:50:56 +0000 | [diff] [blame] | 1217 | def detach_widget(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1218 | self.tk.call(self._w, 'detachwidget', widget._w) |
Martin v. Löwis | 652e191 | 2001-11-25 14:50:56 +0000 | [diff] [blame] | 1219 | |
| 1220 | def hide(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1221 | self.tk.call(self._w, 'hide', widget._w) |
Martin v. Löwis | 652e191 | 2001-11-25 14:50:56 +0000 | [diff] [blame] | 1222 | |
| 1223 | def show(self, widget): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1224 | self.tk.call(self._w, 'show', widget._w) |
Martin v. Löwis | 652e191 | 2001-11-25 14:50:56 +0000 | [diff] [blame] | 1225 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1226 | class ScrolledHList(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1227 | """ScrolledHList - HList with automatic scrollbars.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1228 | |
| 1229 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1230 | TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], |
| 1231 | cnf, kw) |
| 1232 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1233 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1234 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1235 | |
| 1236 | class ScrolledListBox(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1237 | """ScrolledListBox - Listbox with automatic scrollbars.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1238 | |
| 1239 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1240 | TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) |
| 1241 | self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') |
| 1242 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1243 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1244 | |
| 1245 | class ScrolledText(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1246 | """ScrolledText - Text with automatic scrollbars.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1247 | |
| 1248 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1249 | TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) |
| 1250 | self.subwidget_list['text'] = _dummyText(self, 'text') |
| 1251 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1252 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1253 | |
| 1254 | class ScrolledTList(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1255 | """ScrolledTList - TList with automatic scrollbars.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1256 | |
| 1257 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1258 | TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], |
| 1259 | cnf, kw) |
| 1260 | self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') |
| 1261 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1262 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1263 | |
| 1264 | class ScrolledWindow(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1265 | """ScrolledWindow - Window with automatic scrollbars.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1266 | |
| 1267 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1268 | TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) |
| 1269 | self.subwidget_list['window'] = _dummyFrame(self, 'window') |
| 1270 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1271 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1272 | |
| 1273 | class Select(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1274 | """Select - Container of button subwidgets. It can be used to provide |
| 1275 | radio-box or check-box style of selection options for the user. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1276 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1277 | Subwidgets are buttons added dynamically using the add method.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1278 | |
| 1279 | def __init__(self, master, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1280 | TixWidget.__init__(self, master, 'tixSelect', |
| 1281 | ['allowzero', 'radio', 'orientation', 'labelside', |
| 1282 | 'options'], |
| 1283 | cnf, kw) |
| 1284 | self.subwidget_list['label'] = _dummyLabel(self, 'label') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1285 | |
| 1286 | def add(self, name, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1287 | apply(self.tk.call, |
| 1288 | (self._w, 'add', name) + self._options(cnf, kw)) |
| 1289 | self.subwidget_list[name] = _dummyButton(self, name) |
| 1290 | return self.subwidget_list[name] |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1291 | |
| 1292 | def invoke(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1293 | self.tk.call(self._w, 'invoke', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1294 | |
| 1295 | class StdButtonBox(TixWidget): |
| 1296 | """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """ |
| 1297 | |
| 1298 | def __init__(self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1299 | TixWidget.__init__(self, master, 'tixStdButtonBox', |
| 1300 | ['orientation', 'options'], cnf, kw) |
| 1301 | self.subwidget_list['ok'] = _dummyButton(self, 'ok') |
| 1302 | self.subwidget_list['apply'] = _dummyButton(self, 'apply') |
| 1303 | self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') |
| 1304 | self.subwidget_list['help'] = _dummyButton(self, 'help') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1305 | |
| 1306 | def invoke(self, name): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1307 | if self.subwidget_list.has_key(name): |
| 1308 | self.tk.call(self._w, 'invoke', name) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1309 | |
| 1310 | class TList(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1311 | """TList - Hierarchy display widget which can be |
| 1312 | used to display data in a tabular format. The list entries of a TList |
| 1313 | widget are similar to the entries in the Tk listbox widget. The main |
| 1314 | differences are (1) the TList widget can display the list entries in a |
| 1315 | two dimensional format and (2) you can use graphical images as well as |
| 1316 | multiple colors and fonts for the list entries. |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1317 | |
| 1318 | Subwidgets - None""" |
| 1319 | |
| 1320 | def __init__ (self,master=None,cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1321 | TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1322 | |
| 1323 | def active_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1324 | self.tk.call(self._w, 'active', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1325 | |
| 1326 | def active_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1327 | self.tk.call(self._w, 'active', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1328 | |
| 1329 | def anchor_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1330 | self.tk.call(self._w, 'anchor', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1331 | |
| 1332 | def anchor_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1333 | self.tk.call(self._w, 'anchor', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1334 | |
| 1335 | def delete(self, from_, to=None): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1336 | self.tk.call(self._w, 'delete', from_, to) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1337 | |
| 1338 | def dragsite_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1339 | self.tk.call(self._w, 'dragsite', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1340 | |
| 1341 | def dragsite_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1342 | self.tk.call(self._w, 'dragsite', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1343 | |
| 1344 | def dropsite_set(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1345 | self.tk.call(self._w, 'dropsite', 'set', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1346 | |
| 1347 | def dropsite_clear(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1348 | self.tk.call(self._w, 'dropsite', 'clear') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1349 | |
| 1350 | def insert(self, index, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1351 | apply(self.tk.call, |
| 1352 | (self._w, 'insert', index) + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1353 | |
| 1354 | def info_active(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1355 | return self.tk.call(self._w, 'info', 'active') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1356 | |
| 1357 | def info_anchor(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1358 | return self.tk.call(self._w, 'info', 'anchor') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1359 | |
| 1360 | def info_down(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1361 | return self.tk.call(self._w, 'info', 'down', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1362 | |
| 1363 | def info_left(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1364 | return self.tk.call(self._w, 'info', 'left', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1365 | |
| 1366 | def info_right(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1367 | return self.tk.call(self._w, 'info', 'right', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1368 | |
| 1369 | def info_selection(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1370 | c = self.tk.call(self._w, 'info', 'selection') |
| 1371 | return self.tk.splitlist(c) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1372 | |
| 1373 | def info_size(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1374 | return self.tk.call(self._w, 'info', 'size') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1375 | |
| 1376 | def info_up(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1377 | return self.tk.call(self._w, 'info', 'up', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1378 | |
| 1379 | def nearest(self, x, y): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1380 | return self.tk.call(self._w, 'nearest', x, y) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1381 | |
| 1382 | def see(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1383 | self.tk.call(self._w, 'see', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1384 | |
| 1385 | def selection_clear(self, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1386 | apply(self.tk.call, |
| 1387 | (self._w, 'selection', 'clear') + self._options(cnf, kw)) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1388 | |
| 1389 | def selection_includes(self, index): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1390 | return self.tk.call(self._w, 'selection', 'includes', index) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1391 | |
| 1392 | def selection_set(self, first, last=None): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1393 | self.tk.call(self._w, 'selection', 'set', first, last) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1394 | |
| 1395 | def xview(self, *args): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1396 | apply(self.tk.call, (self._w, 'xview') + args) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1397 | |
| 1398 | def yview(self, *args): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1399 | apply(self.tk.call, (self._w, 'yview') + args) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1400 | |
| 1401 | class Tree(TixWidget): |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1402 | """Tree - The tixTree widget can be used to display hierachical |
| 1403 | data in a tree form. The user can adjust |
| 1404 | the view of the tree by opening or closing parts of the tree.""" |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1405 | |
| 1406 | def __init__(self, master=None, cnf={}, **kw): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1407 | TixWidget.__init__(self, master, 'tixTree', |
| 1408 | ['options'], cnf, kw) |
| 1409 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1410 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1411 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1412 | |
| 1413 | def autosetmode(self): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1414 | self.tk.call(self._w, 'autosetmode') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1415 | |
| 1416 | def close(self, entrypath): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1417 | self.tk.call(self._w, 'close', entrypath) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1418 | |
| 1419 | def getmode(self, entrypath): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1420 | return self.tk.call(self._w, 'getmode', entrypath) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1421 | |
| 1422 | def open(self, entrypath): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1423 | self.tk.call(self._w, 'open', entrypath) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1424 | |
| 1425 | def setmode(self, entrypath, mode='none'): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1426 | self.tk.call(self._w, 'setmode', entrypath, mode) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1427 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1428 | |
| 1429 | # Could try subclassing Tree for CheckList - would need another arg to init |
| 1430 | class CheckList(TixWidget): |
| 1431 | """The CheckList widget |
| 1432 | displays a list of items to be selected by the user. CheckList acts |
| 1433 | similarly to the Tk checkbutton or radiobutton widgets, except it is |
| 1434 | capable of handling many more items than checkbuttons or radiobuttons. |
| 1435 | """ |
| 1436 | |
| 1437 | def __init__(self, master=None, cnf={}, **kw): |
| 1438 | TixWidget.__init__(self, master, 'tixCheckList', |
| 1439 | ['options'], cnf, kw) |
| 1440 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1441 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1442 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1443 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1444 | def autosetmode(self): |
| 1445 | self.tk.call(self._w, 'autosetmode') |
| 1446 | |
| 1447 | def close(self, entrypath): |
| 1448 | self.tk.call(self._w, 'close', entrypath) |
| 1449 | |
| 1450 | def getmode(self, entrypath): |
| 1451 | return self.tk.call(self._w, 'getmode', entrypath) |
| 1452 | |
| 1453 | def open(self, entrypath): |
| 1454 | self.tk.call(self._w, 'open', entrypath) |
| 1455 | |
| 1456 | def getselection(self, mode='on'): |
| 1457 | '''Mode can be on, off, default''' |
| 1458 | self.tk.call(self._w, 'getselection', mode) |
| 1459 | |
| 1460 | def getstatus(self, entrypath): |
| 1461 | self.tk.call(self._w, 'getstatus', entrypath) |
| 1462 | |
| 1463 | def setstatus(self, entrypath, mode='on'): |
| 1464 | self.tk.call(self._w, 'setstatus', entrypath, mode) |
| 1465 | |
| 1466 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1467 | ########################################################################### |
| 1468 | ### The subclassing below is used to instantiate the subwidgets in each ### |
| 1469 | ### mega widget. This allows us to access their methods directly. ### |
| 1470 | ########################################################################### |
| 1471 | |
| 1472 | class _dummyButton(Button, TixSubWidget): |
| 1473 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1474 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1475 | |
| 1476 | class _dummyCheckbutton(Checkbutton, TixSubWidget): |
| 1477 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1478 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1479 | |
| 1480 | class _dummyEntry(Entry, TixSubWidget): |
| 1481 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1482 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1483 | |
| 1484 | class _dummyFrame(Frame, TixSubWidget): |
| 1485 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1486 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1487 | |
| 1488 | class _dummyLabel(Label, TixSubWidget): |
| 1489 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1490 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1491 | |
| 1492 | class _dummyListbox(Listbox, TixSubWidget): |
| 1493 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1494 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1495 | |
| 1496 | class _dummyMenu(Menu, TixSubWidget): |
| 1497 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1498 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1499 | |
| 1500 | class _dummyMenubutton(Menubutton, TixSubWidget): |
| 1501 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1502 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1503 | |
| 1504 | class _dummyScrollbar(Scrollbar, TixSubWidget): |
| 1505 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1506 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1507 | |
| 1508 | class _dummyText(Text, TixSubWidget): |
| 1509 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1510 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1511 | |
| 1512 | class _dummyScrolledListBox(ScrolledListBox, TixSubWidget): |
| 1513 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1514 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1515 | self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') |
| 1516 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1517 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1518 | |
| 1519 | class _dummyHList(HList, TixSubWidget): |
| 1520 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1521 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1522 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1523 | class _dummyScrolledHList(ScrolledHList, TixSubWidget): |
| 1524 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1525 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1526 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1527 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1528 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1529 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1530 | class _dummyTList(TList, TixSubWidget): |
| 1531 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1532 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1533 | |
| 1534 | class _dummyComboBox(ComboBox, TixSubWidget): |
| 1535 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1536 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1537 | self.subwidget_list['entry'] = _dummyEntry(self, 'entry') |
| 1538 | self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') |
| 1539 | # I'm not sure about this destroy_physically=0 in all cases; |
| 1540 | # it may depend on if -dropdown is true; I've added as a trial |
| 1541 | self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, |
| 1542 | 'slistbox', |
| 1543 | destroy_physically=0) |
| 1544 | self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox', |
| 1545 | destroy_physically=0) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1546 | |
| 1547 | class _dummyDirList(DirList, TixSubWidget): |
| 1548 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1549 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1550 | self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') |
| 1551 | self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') |
| 1552 | self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1553 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1554 | class _dummyDirSelectBox(DirSelectBox, TixSubWidget): |
| 1555 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1556 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1557 | self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') |
| 1558 | self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1559 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1560 | class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget): |
| 1561 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1562 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1563 | self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') |
| 1564 | self.subwidget_list['ok'] = _dummyButton(self, 'ok') |
| 1565 | self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') |
| 1566 | self.subwidget_list['types'] = _dummyComboBox(self, 'types') |
| 1567 | self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') |
| 1568 | self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') |
| 1569 | self.subwidget_list['file'] = _dummyComboBox(self, 'file') |
| 1570 | self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1571 | |
| 1572 | class _dummyFileSelectBox(FileSelectBox, TixSubWidget): |
| 1573 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1574 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1575 | self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') |
| 1576 | self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') |
| 1577 | self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') |
| 1578 | self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1579 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1580 | class _dummyFileComboBox(ComboBox, TixSubWidget): |
| 1581 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1582 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1583 | self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx') |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1584 | |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1585 | class _dummyStdButtonBox(StdButtonBox, TixSubWidget): |
| 1586 | def __init__(self, master, name, destroy_physically=1): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1587 | TixSubWidget.__init__(self, master, name, destroy_physically) |
| 1588 | self.subwidget_list['ok'] = _dummyButton(self, 'ok') |
| 1589 | self.subwidget_list['apply'] = _dummyButton(self, 'apply') |
| 1590 | self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') |
| 1591 | self.subwidget_list['help'] = _dummyButton(self, 'help') |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1592 | |
| 1593 | class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): |
| 1594 | def __init__(self, master, name, destroy_physically=0): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1595 | TixSubWidget.__init__(self, master, name, destroy_physically) |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1596 | |
| 1597 | ######################## |
| 1598 | ### Utility Routines ### |
| 1599 | ######################## |
| 1600 | |
| 1601 | # Returns the qualified path name for the widget. Normally used to set |
| 1602 | # default options for subwidgets. See tixwidgets.py |
| 1603 | def OptionName(widget): |
| 1604 | return widget.tk.call('tixOptionName', widget._w) |
| 1605 | |
| 1606 | # Called with a dictionary argument of the form |
| 1607 | # {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'} |
| 1608 | # returns a string which can be used to configure the fsbox file types |
| 1609 | # in an ExFileSelectBox. i.e., |
| 1610 | # '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}' |
| 1611 | def FileTypeList(dict): |
| 1612 | s = '' |
| 1613 | for type in dict.keys(): |
Martin v. Löwis | 0c0d56a | 2002-03-28 16:26:40 +0000 | [diff] [blame] | 1614 | s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' |
Martin v. Löwis | b21cb5f | 2001-03-21 07:42:07 +0000 | [diff] [blame] | 1615 | return s |
| 1616 | |
Martin v. Löwis | b7b3260 | 2001-11-02 23:48:20 +0000 | [diff] [blame] | 1617 | # Still to be done: |
| 1618 | class CObjView(TixWidget): |
| 1619 | """This file implements the Canvas Object View widget. This is a base |
| 1620 | class of IconView. It implements automatic placement/adjustment of the |
| 1621 | scrollbars according to the canvas objects inside the canvas subwidget. |
| 1622 | The scrollbars are adjusted so that the canvas is just large enough |
| 1623 | to see all the objects. |
| 1624 | """ |
| 1625 | pass |