Debian Codegraph @

07p/python/auto/graphics/PmwBlt.py

raw symbols SCIP
1 # Python interface to some of the commands of the 2.4 version of the
2 # BLT extension to tcl.
3
4 try:
5 import Tkinter
6 except ImportError:
7 import tkinter as Tkinter # Python 3
8
9 # Supported commands:
10 _busyCommand = '::blt::busy'
11 _vectorCommand = '::blt::vector'
12 _graphCommand = '::blt::graph'
13 _testCommand = '::blt::*'
14 _chartCommand = '::blt::stripchart'
15 _tabsetCommand = '::blt::tabset'
16
17 _haveBlt = None
18 _haveBltBusy = None
19
20 def _checkForBlt(window):
21 global _haveBlt
22 global _haveBltBusy
23
24 # Blt may be a package which has not yet been loaded. Try to load it.
25 try:
26 window.tk.call('package', 'require', 'BLT')
27 except Tkinter.TclError:
28 # Another way to try to dynamically load blt:
29 try:
30 window.tk.call('load', '', 'Blt')
31 except Tkinter.TclError:
32 pass
33
34 _haveBlt= (window.tk.call('info', 'commands', _testCommand) != '')
35 _haveBltBusy = (window.tk.call('info', 'commands', _busyCommand) != '')
36
37 def haveblt(window):
38 if _haveBlt is None:
39 _checkForBlt(window)
40 return _haveBlt
41
42 def havebltbusy(window):
43 if _haveBlt is None:
44 _checkForBlt(window)
45 return _haveBltBusy
46
47 def _loadBlt(window):
48 if _haveBlt is None:
49 if window is None:
50 window = Tkinter._default_root
51 if window is None:
52 window = Tkinter.Tk()
53 _checkForBlt(window)
54
55 def busy_hold(window, cursor = None):
56 _loadBlt(window)
57 if cursor is None:
58 window.tk.call(_busyCommand, 'hold', window._w)
59 else:
60 window.tk.call(_busyCommand, 'hold', window._w, '-cursor', cursor)
61
62 def busy_release(window):
63 _loadBlt(window)
64 window.tk.call(_busyCommand, 'release', window._w)
65
66 def busy_forget(window):
67 _loadBlt(window)
68 window.tk.call(_busyCommand, 'forget', window._w)
69
70 #=============================================================================
71 # Interface to the blt vector command which makes it look like the
72 # builtin python list type.
73 # The -variable, -command, -watchunset creation options are not supported.
74 # The dup, merge, notify, offset, populate, seq and variable methods
75 # and the +, -, * and / operations are not supported.
76
77 # Blt vector functions:
78 def vector_expr(expression):
79 tk = Tkinter._default_root.tk
80 strList = tk.splitlist(tk.call(_vectorCommand, 'expr', expression))
81 return tuple(map(float, strList))
82
83 def vector_names(pattern = None):
84 tk = Tkinter._default_root.tk
85 return tk.splitlist(tk.call(_vectorCommand, 'names', pattern))
86
87 class Vector:
88 _varnum = 0
89 def __init__(self, size=None, master=None):
90 # <size> can be either an integer size, or a string "first:last".
91 _loadBlt(master)
92 if master:
93 self._master = master
94 else:
95 self._master = Tkinter._default_root
96 self.tk = self._master.tk
97 self._name = 'PY_VEC' + str(Vector._varnum)
98 Vector._varnum = Vector._varnum + 1
99 if size is None:
100 self.tk.call(_vectorCommand, 'create', self._name)
101 else:
102 self.tk.call(_vectorCommand, 'create', '%s(%s)' % (self._name, size))
103 def __del__(self):
104 self.tk.call(_vectorCommand, 'destroy', self._name)
105 def __str__(self):
106 return self._name
107
108 def __repr__(self):
109 return '[' + ', '.join(map(str, self)) + ']'
110 def __cmp__(self, list):
111 return cmp(self[:], list)
112
113 def __len__(self):
114 return self.tk.getint(self.tk.call(self._name, 'length'))
115 def __getitem__(self, key):
116 oldkey = key
117 if key < 0:
118 key = key + len(self)
119 try:
120 return self.tk.getdouble(self.tk.globalgetvar(self._name, str(key)))
121 except Tkinter.TclError:
122 raise IndexError(oldkey)
123 def __setitem__(self, key, value):
124 if key < 0:
125 key = key + len(self)
126 return self.tk.globalsetvar(self._name, str(key), float(value))
127
128 def __delitem__(self, key):
129 if key < 0:
130 key = key + len(self)
131 return self.tk.globalunsetvar(self._name, str(key))
132
133 def __getslice__(self, start, end):
134 length = len(self)
135 if start < 0:
136 start = 0
137 if end > length:
138 end = length
139 if start >= end:
140 return []
141 end = end - 1 # Blt vector slices include end point.
142 text = self.tk.globalgetvar(self._name, str(start) + ':' + str(end))
143 return map(self.tk.getdouble, self.tk.splitlist(text))
144
145 def __setslice__(self, start, end, list):
146 if start > end:
147 end = start
148 self.set(self[:start] + list + self[end:])
149
150 def __delslice__(self, start, end):
151 if start < end:
152 self.set(self[:start] + self[end:])
153
154 def __add__(self, list):
155 return self[:] + list
156 def __radd__(self, list):
157 return list + self[:]
158 def __mul__(self, n):
159 return self[:] * n
160 __rmul__ = __mul__
161
162 # Python builtin list methods:
163 def append(self, *args):
164 self.tk.call(self._name, 'append', args)
165 def count(self, obj):
166 return self[:].count(obj)
167 def index(self, value):
168 return self[:].index(value)
169 def insert(self, index, value):
170 self[index:index] = [value]
171 def remove(self, value):
172 del self[self.index(value)]
173 def reverse(self):
174 s = self[:]
175 s.reverse()
176 self.set(s)
177 def sort(self, *args):
178 s = self[:]
179 s.sort()
180 self.set(s)
181
182 # Blt vector instance methods:
183 # append - same as list method above
184 def clear(self):
185 self.tk.call(self._name, 'clear')
186 def delete(self, *args):
187 self.tk.call((self._name, 'delete') + args)
188 def expr(self, expression):
189 self.tk.call(self._name, 'expr', expression)
190 def length(self, newSize=None):
191 return self.tk.getint(self.tk.call(self._name, 'length', newSize))
192 def range(self, first, last=None):
193 # Note that, unlike self[first:last], this includes the last
194 # item in the returned range.
195 text = self.tk.call(self._name, 'range', first, last)
196 return map(self.tk.getdouble, self.tk.splitlist(text))
197 def search(self, start, end=None):
198 return self._master._getints(self.tk.call(
199 self._name, 'search', start, end))
200 def set(self, list):
201 if not isinstance(list, tuple):
202 list = tuple(list)
203 self.tk.call(self._name, 'set', list)
204
205 # The blt vector sort method has different semantics to the python
206 # list sort method. Call these blt_sort:
207 def blt_sort(self, *args):
208 self.tk.call((self._name, 'sort') + args)
209 def blt_sort_reverse(self, *args):
210 self.tk.call((self._name, 'sort', '-reverse') + args)
211
212 # Special blt vector indexes:
213 def min(self):
214 return self.tk.getdouble(self.tk.globalgetvar(self._name, 'min'))
215 def max(self):
216 return self.tk.getdouble(self.tk.globalgetvar(self._name, 'max'))
217
218 # Method borrowed from Tkinter.Var class:
219 def get(self):
220 return self[:]
221
222 #=============================================================================
223
224 # This is a general purpose configure routine which can handle the
225 # configuration of widgets, items within widgets, etc. Supports the
226 # forms configure() and configure('font') for querying and
227 # configure(font = 'fixed', text = 'hello') for setting.
228
229 def _doConfigure(widget, subcommand, option, kw):
230
231 if not option and not kw:
232 # Return a description of all options.
233 ret = {}
234 options = widget.tk.splitlist(widget.tk.call(subcommand))
235 for optionString in options:
236 optionInfo = widget.tk.splitlist(optionString)
237 option = optionInfo[0][1:]
238 ret[option] = (option,) + optionInfo[1:]
239 return ret
240
241 if option:
242 # Return a description of the option given by <option>.
243 if kw:
244 # Having keywords implies setting configuration options.
245 # Can't set and get in one command!
246 raise ValueError('cannot have option argument with keywords')
247 option = '-' + option
248 optionInfo = widget.tk.splitlist(widget.tk.call(subcommand + (option,)))
249 return (optionInfo[0][1:],) + optionInfo[1:]
250
251 # Otherwise, set the given configuration options.
252 widget.tk.call(subcommand + widget._options(kw))
253
254 #=============================================================================
255
256 class Graph(Tkinter.Widget):
257 # Wrapper for the blt graph widget, version 2.4.
258
259 def __init__(self, master=None, cnf={}, **kw):
260 _loadBlt(master)
261 Tkinter.Widget.__init__(self, master, _graphCommand, cnf, kw)
262
263 def bar_create(self, name, **kw):
264 self.tk.call((self._w, 'bar', 'create', name) + self._options(kw))
265
266 def line_create(self, name, **kw):
267 self.tk.call((self._w, 'line', 'create', name) + self._options(kw))
268
269 def extents(self, item):
270 return self.tk.getint(self.tk.call(self._w, 'extents', item))
271
272 def invtransform(self, winX, winY):
273 return self._getdoubles(
274 self.tk.call(self._w, 'invtransform', winX, winY))
275
276 def inside(self, x, y):
277 return self.tk.getint(self.tk.call(self._w, 'inside', x, y))
278
279 def snap(self, photoName):
280 self.tk.call(self._w, 'snap', photoName)
281
282 def transform(self, x, y):
283 return self._getdoubles(self.tk.call(self._w, 'transform', x, y))
284
285 def axis_cget(self, axisName, key):
286 return self.tk.call(self._w, 'axis', 'cget', axisName, '-' + key)
287 def axis_configure(self, axes, option=None, **kw):
288 # <axes> may be a list of axisNames.
289 if isinstance(axes, str):
290 axes = [axes]
291 subcommand = (self._w, 'axis', 'configure') + tuple(axes)
292 return _doConfigure(self, subcommand, option, kw)
293 def axis_create(self, axisName, **kw):
294 self.tk.call((self._w, 'axis', 'create', axisName) + self._options(kw))
295 def axis_delete(self, *args):
296 self.tk.call((self._w, 'axis', 'delete') + args)
297 def axis_invtransform(self, axisName, value):
298 return self.tk.getdouble(self.tk.call(
299 self._w, 'axis', 'invtransform', axisName, value))
300 def axis_limits(self, axisName):
301 return self._getdoubles(self.tk.call(
302 self._w, 'axis', 'limits', axisName))
303 def axis_names(self, *args):
304 return self.tk.splitlist(
305 self.tk.call((self._w, 'axis', 'names') + args))
306 def axis_transform(self, axisName, value):
307 return self.tk.getint(self.tk.call(
308 self._w, 'axis', 'transform', axisName, value))
309
310 def xaxis_cget(self, key):
311 return self.tk.call(self._w, 'xaxis', 'cget', '-' + key)
312 def xaxis_configure(self, option=None, **kw):
313 subcommand = (self._w, 'xaxis', 'configure')
314 return _doConfigure(self, subcommand, option, kw)
315 def xaxis_invtransform(self, value):
316 return self.tk.getdouble(self.tk.call(
317 self._w, 'xaxis', 'invtransform', value))
318 def xaxis_limits(self):
319 return self._getdoubles(self.tk.call(self._w, 'xaxis', 'limits'))
320 def xaxis_transform(self, value):
321 return self.tk.getint(self.tk.call(
322 self._w, 'xaxis', 'transform', value))
323 def xaxis_use(self, axisName = None):
324 return self.tk.call(self._w, 'xaxis', 'use', axisName)
325
326 def x2axis_cget(self, key):
327 return self.tk.call(self._w, 'x2axis', 'cget', '-' + key)
328 def x2axis_configure(self, option=None, **kw):
329 subcommand = (self._w, 'x2axis', 'configure')
330 return _doConfigure(self, subcommand, option, kw)
331 def x2axis_invtransform(self, value):
332 return self.tk.getdouble(self.tk.call(
333 self._w, 'x2axis', 'invtransform', value))
334 def x2axis_limits(self):
335 return self._getdoubles(self.tk.call(self._w, 'x2axis', 'limits'))
336 def x2axis_transform(self, value):
337 return self.tk.getint(self.tk.call(
338 self._w, 'x2axis', 'transform', value))
339 def x2axis_use(self, axisName = None):
340 return self.tk.call(self._w, 'x2axis', 'use', axisName)
341
342 def yaxis_cget(self, key):
343 return self.tk.call(self._w, 'yaxis', 'cget', '-' + key)
344 def yaxis_configure(self, option=None, **kw):
345 subcommand = (self._w, 'yaxis', 'configure')
346 return _doConfigure(self, subcommand, option, kw)
347 def yaxis_invtransform(self, value):
348 return self.tk.getdouble(self.tk.call(
349 self._w, 'yaxis', 'invtransform', value))
350 def yaxis_limits(self):
351 return self._getdoubles(self.tk.call(self._w, 'yaxis', 'limits'))
352 def yaxis_transform(self, value):
353 return self.tk.getint(self.tk.call(
354 self._w, 'yaxis', 'transform', value))
355 def yaxis_use(self, axisName = None):
356 return self.tk.call(self._w, 'yaxis', 'use', axisName)
357
358 def y2axis_cget(self, key):
359 return self.tk.call(self._w, 'y2axis', 'cget', '-' + key)
360 def y2axis_configure(self, option=None, **kw):
361 subcommand = (self._w, 'y2axis', 'configure')
362 return _doConfigure(self, subcommand, option, kw)
363 def y2axis_invtransform(self, value):
364 return self.tk.getdouble(self.tk.call(
365 self._w, 'y2axis', 'invtransform', value))
366 def y2axis_limits(self):
367 return self._getdoubles(self.tk.call(self._w, 'y2axis', 'limits'))
368 def y2axis_transform(self, value):
369 return self.tk.getint(self.tk.call(
370 self._w, 'y2axis', 'transform', value))
371 def y2axis_use(self, axisName = None):
372 return self.tk.call(self._w, 'y2axis', 'use', axisName)
373
374 def crosshairs_cget(self, key):
375 return self.tk.call(self._w, 'crosshairs', 'cget', '-' + key)
376 def crosshairs_configure(self, option=None, **kw):
377 subcommand = (self._w, 'crosshairs', 'configure')
378 return _doConfigure(self, subcommand, option, kw)
379 def crosshairs_off(self):
380 self.tk.call(self._w, 'crosshairs', 'off')
381 def crosshairs_on(self):
382 self.tk.call(self._w, 'crosshairs', 'on')
383 def crosshairs_toggle(self):
384 self.tk.call(self._w, 'crosshairs', 'toggle')
385
386 def element_activate(self, name, *args):
387 self.tk.call((self._w, 'element', 'activate', name) + args)
388 def element_bind(self, tagName, sequence=None, func=None, add=None):
389 return self._bind((self._w, 'element', 'bind', tagName),
390 sequence, func, add)
391 def element_unbind(self, tagName, sequence, funcid=None):
392 self.tk.call(self._w, 'element', 'bind', tagName, sequence, '')
393 if funcid:
394 self.deletecommand(funcid)
395
396 def element_cget(self, name, key):
397 return self.tk.call(self._w, 'element', 'cget', name, '-' + key)
398
399 def element_closest(self, x, y, *args, **kw):
400 var = 'python_private_1'
401 success = self.tk.getint(self.tk.call(
402 (self._w, 'element', 'closest', x, y, var) +
403 self._options(kw) + args))
404 if success:
405 rtn = {}
406 rtn['dist'] = self.tk.getdouble(self.tk.globalgetvar(var, 'dist'))
407 rtn['x'] = self.tk.getdouble(self.tk.globalgetvar(var, 'x'))
408 rtn['y'] = self.tk.getdouble(self.tk.globalgetvar(var, 'y'))
409 rtn['index'] = self.tk.getint(self.tk.globalgetvar(var, 'index'))
410 rtn['name'] = self.tk.globalgetvar(var, 'name')
411 return rtn
412 else:
413 return None
414
415 def element_configure(self, names, option=None, **kw):
416 # <names> may be a list of elemNames.
417 if isinstance(names, str):
418 names = [names]
419 subcommand = (self._w, 'element', 'configure') + tuple(names)
420 return _doConfigure(self, subcommand, option, kw)
421
422 def element_deactivate(self, *args):
423 self.tk.call((self._w, 'element', 'deactivate') + args)
424
425 def element_delete(self, *args):
426 self.tk.call((self._w, 'element', 'delete') + args)
427 def element_exists(self, name):
428 return self.tk.getboolean(
429 self.tk.call(self._w, 'element', 'exists', name))
430
431 def element_names(self, *args):
432 return self.tk.splitlist(
433 self.tk.call((self._w, 'element', 'names') + args))
434 def element_show(self, nameList=None):
435 if nameList is not None:
436 nameList = tuple(nameList)
437 return self.tk.splitlist(
438 self.tk.call(self._w, 'element', 'show', nameList))
439 def element_type(self, name):
440 return self.tk.call(self._w, 'element', 'type', name)
441
442 def grid_cget(self, key):
443 return self.tk.call(self._w, 'grid', 'cget', '-' + key)
444 def grid_configure(self, option=None, **kw):
445 subcommand = (self._w, 'grid', 'configure')
446 return _doConfigure(self, subcommand, option, kw)
447
448 def grid_off(self):
449 self.tk.call(self._w, 'grid', 'off')
450 def grid_on(self):
451 self.tk.call(self._w, 'grid', 'on')
452 def grid_toggle(self):
453 self.tk.call(self._w, 'grid', 'toggle')
454
455 def legend_activate(self, *args):
456 self.tk.call((self._w, 'legend', 'activate') + args)
457 def legend_bind(self, tagName, sequence=None, func=None, add=None):
458 return self._bind((self._w, 'legend', 'bind', tagName),
459 sequence, func, add)
460 def legend_unbind(self, tagName, sequence, funcid=None):
461 self.tk.call(self._w, 'legend', 'bind', tagName, sequence, '')
462 if funcid:
463 self.deletecommand(funcid)
464
465 def legend_cget(self, key):
466 return self.tk.call(self._w, 'legend', 'cget', '-' + key)
467 def legend_configure(self, option=None, **kw):
468 subcommand = (self._w, 'legend', 'configure')
469 return _doConfigure(self, subcommand, option, kw)
470 def legend_deactivate(self, *args):
471 self.tk.call((self._w, 'legend', 'deactivate') + args)
472 def legend_get(self, pos):
473 return self.tk.call(self._w, 'legend', 'get', pos)
474
475 def pen_cget(self, name, key):
476 return self.tk.call(self._w, 'pen', 'cget', name, '-' + key)
477 def pen_configure(self, names, option=None, **kw):
478 # <names> may be a list of penNames.
479 if isinstance(names, str):
480 names = [names]
481 subcommand = (self._w, 'pen', 'configure') + tuple(names)
482 return _doConfigure(self, subcommand, option, kw)
483 def pen_create(self, name, **kw):
484 self.tk.call((self._w, 'pen', 'create', name) + self._options(kw))
485 def pen_delete(self, *args):
486 self.tk.call((self._w, 'pen', 'delete') + args)
487 def pen_names(self, *args):
488 return self.tk.splitlist(self.tk.call((self._w, 'pen', 'names') + args))
489
490 def postscript_cget(self, key):
491 return self.tk.call(self._w, 'postscript', 'cget', '-' + key)
492 def postscript_configure(self, option=None, **kw):
493 subcommand = (self._w, 'postscript', 'configure')
494 return _doConfigure(self, subcommand, option, kw)
495 def postscript_output(self, fileName=None, **kw):
496 prefix = (self._w, 'postscript', 'output')
497 if fileName is None:
498 return self.tk.call(prefix + self._options(kw))
499 else:
500 self.tk.call(prefix + (fileName,) + self._options(kw))
501
502 def marker_after(self, first, second=None):
503 self.tk.call(self._w, 'marker', 'after', first, second)
504 def marker_before(self, first, second=None):
505 self.tk.call(self._w, 'marker', 'before', first, second)
506 def marker_bind(self, tagName, sequence=None, func=None, add=None):
507 return self._bind((self._w, 'marker', 'bind', tagName),
508 sequence, func, add)
509 def marker_unbind(self, tagName, sequence, funcid=None):
510 self.tk.call(self._w, 'marker', 'bind', tagName, sequence, '')
511 if funcid:
512 self.deletecommand(funcid)
513
514 def marker_cget(self, name, key):
515 return self.tk.call(self._w, 'marker', 'cget', name, '-' + key)
516 def marker_configure(self, names, option=None, **kw):
517 # <names> may be a list of markerIds.
518 if isinstance(names, str):
519 names = [names]
520 subcommand = (self._w, 'marker', 'configure') + tuple(names)
521 return _doConfigure(self, subcommand, option, kw)
522 def marker_create(self, type, **kw):
523 return self.tk.call(
524 (self._w, 'marker', 'create', type) + self._options(kw))
525
526 def marker_delete(self, *args):
527 self.tk.call((self._w, 'marker', 'delete') + args)
528 def marker_exists(self, name):
529 return self.tk.getboolean(
530 self.tk.call(self._w, 'marker', 'exists', name))
531 def marker_names(self, *args):
532 return self.tk.splitlist(
533 self.tk.call((self._w, 'marker', 'names') + args))
534 def marker_type(self, name):
535 type = self.tk.call(self._w, 'marker', 'type', name)
536 if type == '':
537 type = None
538 return type
539
540 #=============================================================================
541 class Stripchart(Graph):
542 # Wrapper for the blt stripchart widget, version 2.4.
543
544 def __init__(self, master=None, cnf={}, **kw):
545 _loadBlt(master)
546 Tkinter.Widget.__init__(self, master, _chartCommand, cnf, kw)
547
548 #=============================================================================
549 class Tabset(Tkinter.Widget):
550
551 # Wrapper for the blt TabSet widget, version 2.4.
552
553 def __init__(self, master=None, cnf={}, **kw):
554 _loadBlt(master)
555 Tkinter.Widget.__init__(self, master, _tabsetCommand, cnf, kw)
556
557 def activate(self, tabIndex):
558 self.tk.call(self._w, 'activate', tabIndex)
559
560 # This is the 'bind' sub-command:
561 def tag_bind(self, tagName, sequence=None, func=None, add=None):
562 return self._bind((self._w, 'bind', tagName), sequence, func, add)
563
564 def tag_unbind(self, tagName, sequence, funcid=None):
565 self.tk.call(self._w, 'bind', tagName, sequence, '')
566 if funcid:
567 self.deletecommand(funcid)
568
569 def delete(self, first, last = None):
570 self.tk.call(self._w, 'delete', first, last)
571
572 # This is the 'focus' sub-command:
573 def tab_focus(self, tabIndex):
574 self.tk.call(self._w, 'focus', tabIndex)
575
576 def get(self, tabIndex):
577 return self.tk.call(self._w, 'get', tabIndex)
578
579 def index(self, tabIndex):
580 index = self.tk.call(self._w, 'index', tabIndex)
581 if index == '':
582 return None
583 else:
584 return self.tk.getint(self.tk.call(self._w, 'index', tabIndex))
585
586 def insert(self, position, name1, *names, **kw):
587 self.tk.call(
588 (self._w, 'insert', position, name1) + names + self._options(kw))
589
590 def invoke(self, tabIndex):
591 return self.tk.call(self._w, 'invoke', tabIndex)
592
593 def move(self, tabIndex1, beforeOrAfter, tabIndex2):
594 self.tk.call(self._w, 'move', tabIndex1, beforeOrAfter, tabIndex2)
595
596 def nearest(self, x, y):
597 return self.tk.call(self._w, 'nearest', x, y)
598
599 def scan_mark(self, x, y):
600 self.tk.call(self._w, 'scan', 'mark', x, y)
601
602 def scan_dragto(self, x, y):
603 self.tk.call(self._w, 'scan', 'dragto', x, y)
604
605 def see(self, index):
606 self.tk.call(self._w, 'see', index)
607
608 def see(self, tabIndex):
609 self.tk.call(self._w,'see',tabIndex)
610
611 def size(self):
612 return self.tk.getint(self.tk.call(self._w, 'size'))
613
614 def tab_cget(self, tabIndex, option):
615 if option[:1] != '-':
616 option = '-' + option
617 if option[-1:] == '_':
618 option = option[:-1]
619 return self.tk.call(self._w, 'tab', 'cget', tabIndex, option)
620
621 def tab_configure(self, tabIndexes, option=None, **kw):
622 # <tabIndexes> may be a list of tabs.
623 if isinstance(tabIndexes, (str, int)):
624 tabIndexes = [tabIndexes]
625 subcommand = (self._w, 'tab', 'configure') + tuple(tabIndexes)
626 return _doConfigure(self, subcommand, option, kw)
627
628 def tab_names(self, *args):
629 return self.tk.splitlist(self.tk.call((self._w, 'tab', 'names') + args))
630
631 def tab_tearoff(self, tabIndex, newName = None):
632 if newName is None:
633 name = self.tk.call(self._w, 'tab', 'tearoff', tabIndex)
634 return self.nametowidget(name)
635 else:
636 self.tk.call(self._w, 'tab', 'tearoff', tabIndex, newName)
637
638 def view(self):
639 s = self.tk.call(self._w, 'view')
640 return tuple(map(self.tk.getint, self.tk.splitlist(s)))
641 def view_moveto(self, fraction):
642 self.tk.call(self._w, 'view', 'moveto', fraction)
643 def view_scroll(self, number, what):
644 self.tk.call(self._w, 'view', 'scroll', number, what)