Mercurial > cpython-lru_cache-weakref
annotate Lib/tkinter/__init__.py @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | c40b573c9f7a |
| children |
| rev | line source |
|---|---|
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1 """Wrapper functions for Tcl/Tk. |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2 |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
3 Tkinter provides classes which allow the display, positioning and |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
4 control of widgets. Toplevel widgets are Tk and Toplevel. Other |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
5 widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
6 Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
7 LabelFrame and PanedWindow. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
8 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
9 Properties of the widgets are specified with keyword arguments. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
10 Keyword arguments have the same name as the corresponding resource |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
11 under Tk. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
12 |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
13 Widgets are positioned with one of the geometry managers Place, Pack |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
14 or Grid. These managers can be called with methods place, pack, grid |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
15 available in every Widget. |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
16 |
|
19638
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
17 Actions are bound to events by resources (e.g. keyword argument |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
18 command) or with the method bind. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
19 |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
20 Example (Hello, World): |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
21 import tkinter |
|
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
22 from tkinter.constants import * |
|
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
23 tk = tkinter.Tk() |
|
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
24 frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2) |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
25 frame.pack(fill=BOTH,expand=1) |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
26 label = tkinter.Label(frame, text="Hello, World") |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
27 label.pack(fill=X, expand=1) |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
28 button = tkinter.Button(frame,text="Exit",command=tk.destroy) |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
29 button.pack(side=BOTTOM) |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
30 tk.mainloop() |
|
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
31 """ |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
32 |
|
9763
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
33 import sys |
|
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
34 if sys.platform == "win32": |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
35 # Attempt to configure Tcl/Tk without requiring PATH |
|
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
36 from tkinter import _fix |
|
75864
d42f264f291e
Issue #3035: Unused functions from tkinter are marked as pending peprecated.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
75598
diff
changeset
|
37 |
|
d42f264f291e
Issue #3035: Unused functions from tkinter are marked as pending peprecated.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
75598
diff
changeset
|
38 import warnings |
|
d42f264f291e
Issue #3035: Unused functions from tkinter are marked as pending peprecated.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
75598
diff
changeset
|
39 |
|
9763
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
40 import _tkinter # If this fails your Python may not be configured for Tk |
|
5123
05fffd55b014
Require _tkinter -- don't attempt to import tkinter when _tkinter does
Guido van Rossum <guido@python.org>
parents:
5096
diff
changeset
|
41 TclError = _tkinter.TclError |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
42 from tkinter.constants import * |
|
81527
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
43 import re |
|
2830
bd79cd768ff8
Tk 4.0 and Tcl 7.4 are now standard
Guido van Rossum <guido@python.org>
parents:
2585
diff
changeset
|
44 |
|
75864
d42f264f291e
Issue #3035: Unused functions from tkinter are marked as pending peprecated.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
75598
diff
changeset
|
45 |
|
26428
0103f0b75fe2
Rename want_objects to wantobjects throughout, for consistency.
Martin v. Löwis <martin@v.loewis.de>
parents:
26416
diff
changeset
|
46 wantobjects = 1 |
|
26416
bd09e3a2d536
Patch #518625: Return objects in Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
25754
diff
changeset
|
47 |
|
16517
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
48 TkVersion = float(_tkinter.TK_VERSION) |
|
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
49 TclVersion = float(_tkinter.TCL_VERSION) |
| 1664 | 50 |
|
5944
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
51 READABLE = _tkinter.READABLE |
|
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
52 WRITABLE = _tkinter.WRITABLE |
|
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
53 EXCEPTION = _tkinter.EXCEPTION |
|
6012
d02ac61cd50f
Add dummies for create/delete filehandles, just so that vanilla Grail
Guido van Rossum <guido@python.org>
parents:
5989
diff
changeset
|
54 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
55 |
|
81527
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
56 _magic_re = re.compile(r'([\\{}])') |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
57 _space_re = re.compile(r'([\s])', re.ASCII) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
58 |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
59 def _join(value): |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
60 """Internal function.""" |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
61 return ' '.join(map(_stringify, value)) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
62 |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
63 def _stringify(value): |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
64 """Internal function.""" |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
65 if isinstance(value, (list, tuple)): |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
66 if len(value) == 1: |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
67 value = _stringify(value[0]) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
68 if value[0] == '{': |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
69 value = '{%s}' % value |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
70 else: |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
71 value = '{%s}' % _join(value) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
72 else: |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
73 value = str(value) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
74 if not value: |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
75 value = '{}' |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
76 elif _magic_re.search(value): |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
77 # add '\' before special characters and spaces |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
78 value = _magic_re.sub(r'\\\1', value) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
79 value = _space_re.sub(r'\\\1', value) |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
80 elif value[0] == '"' or _space_re.search(value): |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
81 value = '{%s}' % value |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
82 return value |
|
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
83 |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
84 def _flatten(seq): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
85 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
86 res = () |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
87 for item in seq: |
|
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
88 if isinstance(item, (tuple, list)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
89 res = res + _flatten(item) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
90 elif item is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
91 res = res + (item,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
92 return res |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
93 |
| 12953 | 94 try: _flatten = _tkinter._flatten |
| 95 except AttributeError: pass | |
| 96 | |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
97 def _cnfmerge(cnfs): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
98 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
99 if isinstance(cnfs, dict): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
100 return cnfs |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
101 elif isinstance(cnfs, (type(None), str)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
102 return cnfs |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
103 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
104 cnf = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
105 for c in _flatten(cnfs): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
106 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
107 cnf.update(c) |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
108 except (AttributeError, TypeError) as msg: |
|
40775
4cdf21a0dbbc
Fix most trivially-findable print statements.
Guido van Rossum <guido@python.org>
parents:
40587
diff
changeset
|
109 print("_cnfmerge: fallback due to:", msg) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
110 for k, v in c.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
111 cnf[k] = v |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
112 return cnf |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
113 |
| 12953 | 114 try: _cnfmerge = _tkinter._cnfmerge |
| 115 except AttributeError: pass | |
| 116 | |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
117 class Event: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
118 """Container for the properties of an event. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
119 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
120 Instances of this type are generated if one of the following events occurs: |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
121 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
122 KeyPress, KeyRelease - for keyboard events |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
123 ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
124 Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
125 Colormap, Gravity, Reparent, Property, Destroy, Activate, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
126 Deactivate - for window events. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
127 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
128 If a callback function for one of these events is registered |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
129 using bind, bind_all, bind_class, or tag_bind, the callback is |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
130 called with an Event as first argument. It will have the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
131 following attributes (in braces are the event types for which |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
132 the attribute is valid): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
133 |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
134 serial - serial number of event |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
135 num - mouse button pressed (ButtonPress, ButtonRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
136 focus - whether the window has the focus (Enter, Leave) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
137 height - height of the exposed window (Configure, Expose) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
138 width - width of the exposed window (Configure, Expose) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
139 keycode - keycode of the pressed key (KeyPress, KeyRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
140 state - state of the event as a number (ButtonPress, ButtonRelease, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
141 Enter, KeyPress, KeyRelease, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
142 Leave, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
143 state - state as a string (Visibility) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
144 time - when the event occurred |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
145 x - x-position of the mouse |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
146 y - y-position of the mouse |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
147 x_root - x-position of the mouse on the screen |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
148 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
149 y_root - y-position of the mouse on the screen |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
150 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
151 char - pressed character (KeyPress, KeyRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
152 send_event - see X/Windows documentation |
| 35850 | 153 keysym - keysym of the event as a string (KeyPress, KeyRelease) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
154 keysym_num - keysym of the event as a number (KeyPress, KeyRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
155 type - type of the event as a number |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
156 widget - widget in which the event occurred |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
157 delta - delta of wheel movement (MouseWheel) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
158 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
159 pass |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
160 |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
161 _support_default_root = 1 |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
162 _default_root = None |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
163 |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
164 def NoDefaultRoot(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
165 """Inhibit setting of default root window. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
166 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
167 Call this function to inhibit that the first instance of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
168 Tk is used for windows without an explicit parent window. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
169 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
170 global _support_default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
171 _support_default_root = 0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
172 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
173 _default_root = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
174 del _default_root |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
175 |
|
1671
953e74eac006
Added dictionary mapping names to children, and _name attribute.
Guido van Rossum <guido@python.org>
parents:
1669
diff
changeset
|
176 def _tkerror(err): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
177 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
178 pass |
| 1664 | 179 |
|
80792
fed68e0bce53
Issue #16582: use int exit code in tkinter._exit
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80783
diff
changeset
|
180 def _exit(code=0): |
|
80928
fdf907708f49
Issue #16714: use 'raise' exceptions, don't 'throw'.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80792
diff
changeset
|
181 """Internal function. Calling it will raise the exception SystemExit.""" |
|
80792
fed68e0bce53
Issue #16582: use int exit code in tkinter._exit
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80783
diff
changeset
|
182 try: |
|
fed68e0bce53
Issue #16582: use int exit code in tkinter._exit
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80783
diff
changeset
|
183 code = int(code) |
|
fed68e0bce53
Issue #16582: use int exit code in tkinter._exit
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80783
diff
changeset
|
184 except ValueError: |
|
fed68e0bce53
Issue #16582: use int exit code in tkinter._exit
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80783
diff
changeset
|
185 pass |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
186 raise SystemExit(code) |
|
1714
db0eaef42cb9
Added _exit and register as Tcl command exit. Micro lay-out fix.
Guido van Rossum <guido@python.org>
parents:
1709
diff
changeset
|
187 |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
188 _varnum = 0 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
189 class Variable: |
|
28642
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
190 """Class to define value holders for e.g. buttons. |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
191 |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
192 Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
193 that constrain the type of the value returned from get().""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
194 _default = "" |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
195 _tk = None |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
196 def __init__(self, master=None, value=None, name=None): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
197 """Construct a variable |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
198 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
199 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
200 VALUE is an optional value (defaults to "") |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
201 NAME is an optional Tcl name (defaults to PY_VARnum). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
202 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
203 If NAME matches an existing variable and VALUE is omitted |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
204 then the existing value is retained. |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
205 """ |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
206 # check for type of NAME parameter to override weird error message |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
207 # raised from Modules/_tkinter.c:SetVar like: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
208 # TypeError: setvar() takes exactly 3 arguments (2 given) |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
209 if name is not None and not isinstance(name, str): |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
210 raise TypeError("name must be a string") |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
211 global _varnum |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
212 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
213 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
214 self._master = master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
215 self._tk = master.tk |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
216 if name: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
217 self._name = name |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
218 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
219 self._name = 'PY_VAR' + repr(_varnum) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
220 _varnum += 1 |
|
46222
aed698c8647b
Merged revisions 62021,62029,62035-62038,62043-62044,62052-62053 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
44428
diff
changeset
|
221 if value is not None: |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
222 self.initialize(value) |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
223 elif not self._tk.call("info", "exists", self._name): |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
224 self.initialize(self._default) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
225 def __del__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
226 """Unset the variable in Tcl.""" |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
227 if (self._tk is not None and self._tk.call("info", "exists", |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
228 self._name)): |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
229 self._tk.globalunsetvar(self._name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
230 def __str__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
231 """Return the name of the variable in Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
232 return self._name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
233 def set(self, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
234 """Set the variable to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
235 return self._tk.globalsetvar(self._name, value) |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
236 initialize = set |
|
28642
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
237 def get(self): |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
238 """Return value of variable.""" |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
239 return self._tk.globalgetvar(self._name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
240 def trace_variable(self, mode, callback): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
241 """Define a trace callback for the variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
242 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
243 MODE is one of "r", "w", "u" for read, write, undefine. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
244 CALLBACK must be a function which is called when |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
245 the variable is read, written or undefined. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
246 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
247 Return the name of the callback. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
248 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
249 cbname = self._master._register(callback) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
250 self._tk.call("trace", "variable", self._name, mode, cbname) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
251 return cbname |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
252 trace = trace_variable |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
253 def trace_vdelete(self, mode, cbname): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
254 """Delete the trace callback for a variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
255 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
256 MODE is one of "r", "w", "u" for read, write, undefine. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
257 CBNAME is the name of the callback returned from trace_variable or trace. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
258 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
259 self._tk.call("trace", "vdelete", self._name, mode, cbname) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
260 self._master.deletecommand(cbname) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
261 def trace_vinfo(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
262 """Return all trace callback information.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
263 return [self._tk.split(x) for x in self._tk.splitlist( |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
264 self._tk.call("trace", "vinfo", self._name))] |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
265 def __eq__(self, other): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
266 """Comparison for equality (==). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
267 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
268 Note: if the Variable's master matters to behavior |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
269 also compare self._master == other._master |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
270 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
271 return self.__class__.__name__ == other.__class__.__name__ \ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
272 and self._name == other._name |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
273 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
274 class StringVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
275 """Value holder for strings variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
276 _default = "" |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
277 def __init__(self, master=None, value=None, name=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
278 """Construct a string variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
279 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
280 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
281 VALUE is an optional value (defaults to "") |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
282 NAME is an optional Tcl name (defaults to PY_VARnum). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
283 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
284 If NAME matches an existing variable and VALUE is omitted |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
285 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
286 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
287 Variable.__init__(self, master, value, name) |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
288 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
289 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
290 """Return value of variable as string.""" |
|
28639
be0d4ec6bf5a
For StringVar results to strings. Document that boolean things are of
Martin v. Löwis <martin@v.loewis.de>
parents:
28513
diff
changeset
|
291 value = self._tk.globalgetvar(self._name) |
|
43577
ace45b361e87
Patch# 1258 by Christian Heimes: kill basestring.
Guido van Rossum <guido@python.org>
parents:
43020
diff
changeset
|
292 if isinstance(value, str): |
|
28639
be0d4ec6bf5a
For StringVar results to strings. Document that boolean things are of
Martin v. Löwis <martin@v.loewis.de>
parents:
28513
diff
changeset
|
293 return value |
|
be0d4ec6bf5a
For StringVar results to strings. Document that boolean things are of
Martin v. Löwis <martin@v.loewis.de>
parents:
28513
diff
changeset
|
294 return str(value) |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
295 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
296 class IntVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
297 """Value holder for integer variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
298 _default = 0 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
299 def __init__(self, master=None, value=None, name=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
300 """Construct an integer variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
301 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
302 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
303 VALUE is an optional value (defaults to 0) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
304 NAME is an optional Tcl name (defaults to PY_VARnum). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
305 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
306 If NAME matches an existing variable and VALUE is omitted |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
307 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
308 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
309 Variable.__init__(self, master, value, name) |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
310 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
311 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
312 """Return the value of the variable as an integer.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
313 return getint(self._tk.globalgetvar(self._name)) |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
314 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
315 class DoubleVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
316 """Value holder for float variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
317 _default = 0.0 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
318 def __init__(self, master=None, value=None, name=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
319 """Construct a float variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
320 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
321 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
322 VALUE is an optional value (defaults to 0.0) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
323 NAME is an optional Tcl name (defaults to PY_VARnum). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
324 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
325 If NAME matches an existing variable and VALUE is omitted |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
326 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
327 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
328 Variable.__init__(self, master, value, name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
329 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
330 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
331 """Return the value of the variable as a float.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
332 return getdouble(self._tk.globalgetvar(self._name)) |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
333 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
334 class BooleanVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
335 """Value holder for boolean variables.""" |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
336 _default = False |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
337 def __init__(self, master=None, value=None, name=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
338 """Construct a boolean variable. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
339 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
340 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
341 VALUE is an optional value (defaults to False) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
342 NAME is an optional Tcl name (defaults to PY_VARnum). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
343 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
344 If NAME matches an existing variable and VALUE is omitted |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
345 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
346 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
347 Variable.__init__(self, master, value, name) |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
348 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
349 def get(self): |
|
28639
be0d4ec6bf5a
For StringVar results to strings. Document that boolean things are of
Martin v. Löwis <martin@v.loewis.de>
parents:
28513
diff
changeset
|
350 """Return the value of the variable as a bool.""" |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
351 try: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
352 return self._tk.getboolean(self._tk.globalgetvar(self._name)) |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
353 except TclError: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
354 raise ValueError("invalid literal for getboolean()") |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
355 |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
356 def mainloop(n=0): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
357 """Run the main loop of Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
358 _default_root.tk.mainloop(n) |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
359 |
|
8209
34cca832a4af
Another optimization, probably of negligeable effect: instead of
Guido van Rossum <guido@python.org>
parents:
8207
diff
changeset
|
360 getint = int |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
361 |
|
8209
34cca832a4af
Another optimization, probably of negligeable effect: instead of
Guido van Rossum <guido@python.org>
parents:
8207
diff
changeset
|
362 getdouble = float |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
363 |
|
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
364 def getboolean(s): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
365 """Convert true and false to integer values 1 and 0.""" |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
366 try: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
367 return _default_root.tk.getboolean(s) |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
368 except TclError: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
369 raise ValueError("invalid literal for getboolean()") |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
370 |
| 6571 | 371 # Methods defined on both toplevel and interior widgets |
| 1664 | 372 class Misc: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
373 """Internal class. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
374 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
375 Base class which defines methods common for interior widgets.""" |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
376 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
377 # XXX font command? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
378 _tclCommands = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
379 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
380 """Internal function. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
381 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
382 Delete all Tcl commands created for |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
383 this widget in the Tcl interpreter.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
384 if self._tclCommands is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
385 for name in self._tclCommands: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
386 #print '- Tkinter: deleted command', name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
387 self.tk.deletecommand(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
388 self._tclCommands = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
389 def deletecommand(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
390 """Internal function. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
391 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
392 Delete the Tcl command provided in NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
393 #print '- Tkinter: deleted command', name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
394 self.tk.deletecommand(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
395 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
396 self._tclCommands.remove(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
397 except ValueError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
398 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
399 def tk_strictMotif(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
400 """Set Tcl internal variable, whether the look and feel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
401 should adhere to Motif. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
402 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
403 A parameter of 1 means adhere to Motif (e.g. no color |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
404 change if mouse passes over slider). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
405 Returns the set value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
406 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
407 'set', 'tk_strictMotif', boolean)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
408 def tk_bisque(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
409 """Change the color scheme to light brown as used in Tk 3.6 and before.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
410 self.tk.call('tk_bisque') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
411 def tk_setPalette(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
412 """Set a new color scheme for all widget elements. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
413 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
414 A single color as argument will cause that all colors of Tk |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
415 widget elements are derived from this. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
416 Alternatively several keyword parameters and its associated |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
417 colors can be given. The following keywords are valid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
418 activeBackground, foreground, selectColor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
419 activeForeground, highlightBackground, selectBackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
420 background, highlightColor, selectForeground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
421 disabledForeground, insertBackground, troughColor.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
422 self.tk.call(('tk_setPalette',) |
|
81219
956cfe53a99f
Issue #16541: tk_setPalette() now works with keyword arguments.
Serhiy Storchaka <storchaka@gmail.com>
parents:
80928
diff
changeset
|
423 + _flatten(args) + _flatten(list(kw.items()))) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
424 def tk_menuBar(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
425 """Do not use. Needed in Tk 3.6 and earlier.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
426 pass # obsolete since Tk 4.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
427 def wait_variable(self, name='PY_VAR'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
428 """Wait until the variable is modified. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
429 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
430 A parameter of type IntVar, StringVar, DoubleVar or |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
431 BooleanVar must be given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
432 self.tk.call('tkwait', 'variable', name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
433 waitvar = wait_variable # XXX b/w compat |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
434 def wait_window(self, window=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
435 """Wait until a WIDGET is destroyed. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
436 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
437 If no parameter is given self is used.""" |
|
15540
9d43129c8c55
Update the code to better reflect recommended style:
Fred Drake <fdrake@acm.org>
parents:
15308
diff
changeset
|
438 if window is None: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
439 window = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
440 self.tk.call('tkwait', 'window', window._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
441 def wait_visibility(self, window=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
442 """Wait until the visibility of a WIDGET changes |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
443 (e.g. it appears). |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
444 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
445 If no parameter is given self is used.""" |
|
15540
9d43129c8c55
Update the code to better reflect recommended style:
Fred Drake <fdrake@acm.org>
parents:
15308
diff
changeset
|
446 if window is None: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
447 window = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
448 self.tk.call('tkwait', 'visibility', window._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
449 def setvar(self, name='PY_VAR', value='1'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
450 """Set Tcl variable NAME to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
451 self.tk.setvar(name, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
452 def getvar(self, name='PY_VAR'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
453 """Return value of Tcl variable NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
454 return self.tk.getvar(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
455 getint = int |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
456 getdouble = float |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
457 def getboolean(self, s): |
|
28645
b9745cd791bf
Remove extra space in docstring
Neal Norwitz <nnorwitz@gmail.com>
parents:
28642
diff
changeset
|
458 """Return a boolean value for Tcl boolean values true and false given as parameter.""" |
|
75569
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
459 try: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
460 return self.tk.getboolean(s) |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
461 except TclError: |
|
79bb99ec2464
Issue #1178863: Separate initialisation from setting when initializing
Martin v. Löwis <martin@v.loewis.de>
parents:
73345
diff
changeset
|
462 raise ValueError("invalid literal for getboolean()") |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
463 def focus_set(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
464 """Direct input focus to this widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
465 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
466 If the application currently does not have the focus |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
467 this widget will get the focus if the application gets |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
468 the focus through the window manager.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
469 self.tk.call('focus', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
470 focus = focus_set # XXX b/w compat? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
471 def focus_force(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
472 """Direct input focus to this widget even if the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
473 application does not have the focus. Use with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
474 caution!""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
475 self.tk.call('focus', '-force', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
476 def focus_get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
477 """Return the widget which has currently the focus in the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
478 application. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
479 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
480 Use focus_displayof to allow working with several |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
481 displays. Return None if application does not have |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
482 the focus.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
483 name = self.tk.call('focus') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
484 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
485 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
486 def focus_displayof(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
487 """Return the widget which has currently the focus on the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
488 display where this widget is located. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
489 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
490 Return None if the application does not have the focus.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
491 name = self.tk.call('focus', '-displayof', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
492 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
493 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
494 def focus_lastfor(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
495 """Return the widget which would have the focus if top level |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
496 for this widget gets the focus from the window manager.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
497 name = self.tk.call('focus', '-lastfor', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
498 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
499 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
500 def tk_focusFollowsMouse(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
501 """The widget under mouse will get automatically focus. Can not |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
502 be disabled easily.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
503 self.tk.call('tk_focusFollowsMouse') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
504 def tk_focusNext(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
505 """Return the next widget in the focus order which follows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
506 widget which has currently the focus. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
507 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
508 The focus order first goes to the next child, then to |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
509 the children of the child recursively and then to the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
510 next sibling which is higher in the stacking order. A |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
511 widget is omitted if it has the takefocus resource set |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
512 to 0.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
513 name = self.tk.call('tk_focusNext', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
514 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
515 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
516 def tk_focusPrev(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
517 """Return previous widget in the focus order. See tk_focusNext for details.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
518 name = self.tk.call('tk_focusPrev', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
519 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
520 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
521 def after(self, ms, func=None, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
522 """Call function once after given time. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
523 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
524 MS specifies the time in milliseconds. FUNC gives the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
525 function which shall be called. Additional parameters |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
526 are given as parameters to the function call. Return |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
527 identifier to cancel scheduling with after_cancel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
528 if not func: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
529 # I'd rather use time.sleep(ms*0.001) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
530 self.tk.call('after', ms) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
531 else: |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
532 def callit(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
533 try: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
534 func(*args) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
535 finally: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
536 try: |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
537 self.deletecommand(name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
538 except TclError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
539 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
540 name = self._register(callit) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
541 return self.tk.call('after', ms, name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
542 def after_idle(self, func, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
543 """Call FUNC once if the Tcl main loop has no event to |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
544 process. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
545 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
546 Return an identifier to cancel the scheduling with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
547 after_cancel.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
548 return self.after('idle', func, *args) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
549 def after_cancel(self, id): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
550 """Cancel scheduling of function identified with ID. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
551 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
552 Identifier returned by after or after_idle must be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
553 given as first parameter.""" |
|
29372
20e1ad3ae8bb
Patch #749191: Delete commands in after_cancel. Will backport to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
29248
diff
changeset
|
554 try: |
|
29729
37216e1c6747
Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Neal Norwitz <nnorwitz@gmail.com>
parents:
29372
diff
changeset
|
555 data = self.tk.call('after', 'info', id) |
|
37216e1c6747
Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Neal Norwitz <nnorwitz@gmail.com>
parents:
29372
diff
changeset
|
556 # In Tk 8.3, splitlist returns: (script, type) |
|
37216e1c6747
Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Neal Norwitz <nnorwitz@gmail.com>
parents:
29372
diff
changeset
|
557 # In Tk 8.4, splitlist may return (script, type) or (script,) |
|
37216e1c6747
Fix SF bug #763637, 2.3b2 unpack tuple of wrong size in after_cancel
Neal Norwitz <nnorwitz@gmail.com>
parents:
29372
diff
changeset
|
558 script = self.tk.splitlist(data)[0] |
|
29372
20e1ad3ae8bb
Patch #749191: Delete commands in after_cancel. Will backport to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
29248
diff
changeset
|
559 self.deletecommand(script) |
|
20e1ad3ae8bb
Patch #749191: Delete commands in after_cancel. Will backport to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
29248
diff
changeset
|
560 except TclError: |
|
20e1ad3ae8bb
Patch #749191: Delete commands in after_cancel. Will backport to 2.2.
Martin v. Löwis <martin@v.loewis.de>
parents:
29248
diff
changeset
|
561 pass |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
562 self.tk.call('after', 'cancel', id) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
563 def bell(self, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
564 """Ring a display's bell.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
565 self.tk.call(('bell',) + self._displayof(displayof)) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
566 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
567 # Clipboard handling: |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
568 def clipboard_get(self, **kw): |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
569 """Retrieve data from the clipboard on window's display. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
570 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
571 The window keyword defaults to the root window of the Tkinter |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
572 application. |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
573 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
574 The type keyword specifies the form in which the data is |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
575 to be returned and should be an atom name such as STRING |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
576 or FILE_NAME. Type defaults to STRING, except on X11, where the default |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
577 is to try UTF8_STRING and fall back to STRING. |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
578 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
579 This command is equivalent to: |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
580 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
581 selection_get(CLIPBOARD) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
582 """ |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
583 if 'type' not in kw and self._windowingsystem == 'x11': |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
584 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
585 kw['type'] = 'UTF8_STRING' |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
586 return self.tk.call(('clipboard', 'get') + self._options(kw)) |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
587 except TclError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
588 del kw['type'] |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
589 return self.tk.call(('clipboard', 'get') + self._options(kw)) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
590 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
591 def clipboard_clear(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
592 """Clear the data in the Tk clipboard. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
593 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
594 A widget specified for the optional displayof keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
595 argument specifies the target display.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
596 if 'displayof' not in kw: kw['displayof'] = self._w |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
597 self.tk.call(('clipboard', 'clear') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
598 def clipboard_append(self, string, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
599 """Append STRING to the Tk clipboard. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
600 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
601 A widget specified at the optional displayof keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
602 argument specifies the target display. The clipboard |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
603 can be retrieved with selection_get.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
604 if 'displayof' not in kw: kw['displayof'] = self._w |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
605 self.tk.call(('clipboard', 'append') + self._options(kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
606 + ('--', string)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
607 # XXX grab current w/o window argument |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
608 def grab_current(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
609 """Return widget which has currently the grab in this application |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
610 or None.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
611 name = self.tk.call('grab', 'current', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
612 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
613 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
614 def grab_release(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
615 """Release grab for this widget if currently set.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
616 self.tk.call('grab', 'release', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
617 def grab_set(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
618 """Set grab for this widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
619 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
620 A grab directs all events to this and descendant |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
621 widgets in the application.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
622 self.tk.call('grab', 'set', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
623 def grab_set_global(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
624 """Set global grab for this widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
625 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
626 A global grab directs all events to this and |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
627 descendant widgets on the display. Use with caution - |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
628 other applications do not get events anymore.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
629 self.tk.call('grab', 'set', '-global', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
630 def grab_status(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
631 """Return None, "local" or "global" if this widget has |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
632 no, a local or a global grab.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
633 status = self.tk.call('grab', 'status', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
634 if status == 'none': status = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
635 return status |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
636 def option_add(self, pattern, value, priority = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
637 """Set a VALUE (second parameter) for an option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
638 PATTERN (first parameter). |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
639 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
640 An optional third parameter gives the numeric priority |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
641 (defaults to 80).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
642 self.tk.call('option', 'add', pattern, value, priority) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
643 def option_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
644 """Clear the option database. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
645 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
646 It will be reloaded if option_add is called.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
647 self.tk.call('option', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
648 def option_get(self, name, className): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
649 """Return the value for an option NAME for this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
650 with CLASSNAME. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
651 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
652 Values with higher priority override lower values.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
653 return self.tk.call('option', 'get', self._w, name, className) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
654 def option_readfile(self, fileName, priority = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
655 """Read file FILENAME into the option database. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
656 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
657 An optional second parameter gives the numeric |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
658 priority.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
659 self.tk.call('option', 'readfile', fileName, priority) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
660 def selection_clear(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
661 """Clear the current X selection.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
662 if 'displayof' not in kw: kw['displayof'] = self._w |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
663 self.tk.call(('selection', 'clear') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
664 def selection_get(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
665 """Return the contents of the current X selection. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
666 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
667 A keyword parameter selection specifies the name of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
668 the selection and defaults to PRIMARY. A keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
669 parameter displayof specifies a widget on the display |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
670 to use. A keyword parameter type specifies the form of data to be |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
671 fetched, defaulting to STRING except on X11, where UTF8_STRING is tried |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
672 before STRING.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
673 if 'displayof' not in kw: kw['displayof'] = self._w |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
674 if 'type' not in kw and self._windowingsystem == 'x11': |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
675 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
676 kw['type'] = 'UTF8_STRING' |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
677 return self.tk.call(('selection', 'get') + self._options(kw)) |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
678 except TclError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
679 del kw['type'] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
680 return self.tk.call(('selection', 'get') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
681 def selection_handle(self, command, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
682 """Specify a function COMMAND to call if the X |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
683 selection owned by this widget is queried by another |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
684 application. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
685 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
686 This function must return the contents of the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
687 selection. The function will be called with the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
688 arguments OFFSET and LENGTH which allows the chunking |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
689 of very long selections. The following keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
690 parameters can be provided: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
691 selection - name of the selection (default PRIMARY), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
692 type - type of the selection (e.g. STRING, FILE_NAME).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
693 name = self._register(command) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
694 self.tk.call(('selection', 'handle') + self._options(kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
695 + (self._w, name)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
696 def selection_own(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
697 """Become owner of X selection. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
698 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
699 A keyword parameter selection specifies the name of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
700 the selection (default PRIMARY).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
701 self.tk.call(('selection', 'own') + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
702 self._options(kw) + (self._w,)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
703 def selection_own_get(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
704 """Return owner of X selection. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
705 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
706 The following keyword parameter can |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
707 be provided: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
708 selection - name of the selection (default PRIMARY), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
709 type - type of the selection (e.g. STRING, FILE_NAME).""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
710 if 'displayof' not in kw: kw['displayof'] = self._w |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
711 name = self.tk.call(('selection', 'own') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
712 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
713 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
714 def send(self, interp, cmd, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
715 """Send Tcl command CMD to different interpreter INTERP to be executed.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
716 return self.tk.call(('send', interp, cmd) + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
717 def lower(self, belowThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
718 """Lower this widget in the stacking order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
719 self.tk.call('lower', self._w, belowThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
720 def tkraise(self, aboveThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
721 """Raise this widget in the stacking order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
722 self.tk.call('raise', self._w, aboveThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
723 lift = tkraise |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
724 def colormodel(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
725 """Useless. Not implemented in Tk.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
726 return self.tk.call('tk', 'colormodel', self._w, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
727 def winfo_atom(self, name, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
728 """Return integer which represents atom NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
729 args = ('winfo', 'atom') + self._displayof(displayof) + (name,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
730 return getint(self.tk.call(args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
731 def winfo_atomname(self, id, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
732 """Return name of atom with identifier ID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
733 args = ('winfo', 'atomname') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
734 + self._displayof(displayof) + (id,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
735 return self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
736 def winfo_cells(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
737 """Return number of cells in the colormap for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
738 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
739 self.tk.call('winfo', 'cells', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
740 def winfo_children(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
741 """Return a list of all widgets which are children of this widget.""" |
|
22608
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
742 result = [] |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
743 for child in self.tk.splitlist( |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
744 self.tk.call('winfo', 'children', self._w)): |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
745 try: |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
746 # Tcl sometimes returns extra windows, e.g. for |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
747 # menus; those need to be skipped |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
748 result.append(self._nametowidget(child)) |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
749 except KeyError: |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
750 pass |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
751 return result |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
752 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
753 def winfo_class(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
754 """Return window class name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
755 return self.tk.call('winfo', 'class', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
756 def winfo_colormapfull(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
757 """Return true if at the last color request the colormap was full.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
758 return self.tk.getboolean( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
759 self.tk.call('winfo', 'colormapfull', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
760 def winfo_containing(self, rootX, rootY, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
761 """Return the widget which is at the root coordinates ROOTX, ROOTY.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
762 args = ('winfo', 'containing') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
763 + self._displayof(displayof) + (rootX, rootY) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
764 name = self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
765 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
766 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
767 def winfo_depth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
768 """Return the number of bits per pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
769 return getint(self.tk.call('winfo', 'depth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
770 def winfo_exists(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
771 """Return true if this widget exists.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
772 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
773 self.tk.call('winfo', 'exists', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
774 def winfo_fpixels(self, number): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
775 """Return the number of pixels for the given distance NUMBER |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
776 (e.g. "3c") as float.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
777 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
778 'winfo', 'fpixels', self._w, number)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
779 def winfo_geometry(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
780 """Return geometry string for this widget in the form "widthxheight+X+Y".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
781 return self.tk.call('winfo', 'geometry', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
782 def winfo_height(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
783 """Return height of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
784 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
785 self.tk.call('winfo', 'height', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
786 def winfo_id(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
787 """Return identifier ID for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
788 return self.tk.getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
789 self.tk.call('winfo', 'id', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
790 def winfo_interps(self, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
791 """Return the name of all Tcl interpreters for this display.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
792 args = ('winfo', 'interps') + self._displayof(displayof) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
793 return self.tk.splitlist(self.tk.call(args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
794 def winfo_ismapped(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
795 """Return true if this widget is mapped.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
796 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
797 self.tk.call('winfo', 'ismapped', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
798 def winfo_manager(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
799 """Return the window mananger name for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
800 return self.tk.call('winfo', 'manager', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
801 def winfo_name(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
802 """Return the name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
803 return self.tk.call('winfo', 'name', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
804 def winfo_parent(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
805 """Return the name of the parent of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
806 return self.tk.call('winfo', 'parent', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
807 def winfo_pathname(self, id, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
808 """Return the pathname of the widget given by ID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
809 args = ('winfo', 'pathname') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
810 + self._displayof(displayof) + (id,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
811 return self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
812 def winfo_pixels(self, number): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
813 """Rounded integer value of winfo_fpixels.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
814 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
815 self.tk.call('winfo', 'pixels', self._w, number)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
816 def winfo_pointerx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
817 """Return the x coordinate of the pointer on the root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
818 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
819 self.tk.call('winfo', 'pointerx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
820 def winfo_pointerxy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
821 """Return a tuple of x and y coordinates of the pointer on the root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
822 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
823 self.tk.call('winfo', 'pointerxy', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
824 def winfo_pointery(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
825 """Return the y coordinate of the pointer on the root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
826 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
827 self.tk.call('winfo', 'pointery', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
828 def winfo_reqheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
829 """Return requested height of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
830 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
831 self.tk.call('winfo', 'reqheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
832 def winfo_reqwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
833 """Return requested width of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
834 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
835 self.tk.call('winfo', 'reqwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
836 def winfo_rgb(self, color): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
837 """Return tuple of decimal values for red, green, blue for |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
838 COLOR in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
839 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
840 self.tk.call('winfo', 'rgb', self._w, color)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
841 def winfo_rootx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
842 """Return x coordinate of upper left corner of this widget on the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
843 root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
844 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
845 self.tk.call('winfo', 'rootx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
846 def winfo_rooty(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
847 """Return y coordinate of upper left corner of this widget on the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
848 root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
849 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
850 self.tk.call('winfo', 'rooty', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
851 def winfo_screen(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
852 """Return the screen name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
853 return self.tk.call('winfo', 'screen', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
854 def winfo_screencells(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
855 """Return the number of the cells in the colormap of the screen |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
856 of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
857 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
858 self.tk.call('winfo', 'screencells', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
859 def winfo_screendepth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
860 """Return the number of bits per pixel of the root window of the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
861 screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
862 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
863 self.tk.call('winfo', 'screendepth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
864 def winfo_screenheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
865 """Return the number of pixels of the height of the screen of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
866 in pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
867 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
868 self.tk.call('winfo', 'screenheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
869 def winfo_screenmmheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
870 """Return the number of pixels of the height of the screen of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
871 this widget in mm.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
872 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
873 self.tk.call('winfo', 'screenmmheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
874 def winfo_screenmmwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
875 """Return the number of pixels of the width of the screen of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
876 this widget in mm.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
877 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
878 self.tk.call('winfo', 'screenmmwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
879 def winfo_screenvisual(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
880 """Return one of the strings directcolor, grayscale, pseudocolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
881 staticcolor, staticgray, or truecolor for the default |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
882 colormodel of this screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
883 return self.tk.call('winfo', 'screenvisual', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
884 def winfo_screenwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
885 """Return the number of pixels of the width of the screen of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
886 this widget in pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
887 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
888 self.tk.call('winfo', 'screenwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
889 def winfo_server(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
890 """Return information of the X-Server of the screen of this widget in |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
891 the form "XmajorRminor vendor vendorVersion".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
892 return self.tk.call('winfo', 'server', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
893 def winfo_toplevel(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
894 """Return the toplevel widget of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
895 return self._nametowidget(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
896 'winfo', 'toplevel', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
897 def winfo_viewable(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
898 """Return true if the widget and all its higher ancestors are mapped.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
899 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
900 self.tk.call('winfo', 'viewable', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
901 def winfo_visual(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
902 """Return one of the strings directcolor, grayscale, pseudocolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
903 staticcolor, staticgray, or truecolor for the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
904 colormodel of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
905 return self.tk.call('winfo', 'visual', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
906 def winfo_visualid(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
907 """Return the X identifier for the visual for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
908 return self.tk.call('winfo', 'visualid', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
909 def winfo_visualsavailable(self, includeids=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
910 """Return a list of all visuals available for the screen |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
911 of this widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
912 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
913 Each item in the list consists of a visual name (see winfo_visual), a |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
914 depth and if INCLUDEIDS=1 is given also the X identifier.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
915 data = self.tk.split( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
916 self.tk.call('winfo', 'visualsavailable', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
917 includeids and 'includeids' or None)) |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
918 if isinstance(data, str): |
|
13907
446c3616c323
-- don't mess up in winfo_visualsavailable if the system only
Fredrik Lundh <fredrik@pythonware.com>
parents:
13906
diff
changeset
|
919 data = [self.tk.split(data)] |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
920 return [self.__winfo_parseitem(x) for x in data] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
921 def __winfo_parseitem(self, t): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
922 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
923 return t[:1] + tuple(map(self.__winfo_getint, t[1:])) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
924 def __winfo_getint(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
925 """Internal function.""" |
|
16517
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
926 return int(x, 0) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
927 def winfo_vrootheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
928 """Return the height of the virtual root window associated with this |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
929 widget in pixels. If there is no virtual root window return the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
930 height of the screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
931 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
932 self.tk.call('winfo', 'vrootheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
933 def winfo_vrootwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
934 """Return the width of the virtual root window associated with this |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
935 widget in pixel. If there is no virtual root window return the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
936 width of the screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
937 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
938 self.tk.call('winfo', 'vrootwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
939 def winfo_vrootx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
940 """Return the x offset of the virtual root relative to the root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
941 window of the screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
942 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
943 self.tk.call('winfo', 'vrootx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
944 def winfo_vrooty(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
945 """Return the y offset of the virtual root relative to the root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
946 window of the screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
947 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
948 self.tk.call('winfo', 'vrooty', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
949 def winfo_width(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
950 """Return the width of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
951 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
952 self.tk.call('winfo', 'width', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
953 def winfo_x(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
954 """Return the x coordinate of the upper left corner of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
955 in the parent.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
956 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
957 self.tk.call('winfo', 'x', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
958 def winfo_y(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
959 """Return the y coordinate of the upper left corner of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
960 in the parent.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
961 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
962 self.tk.call('winfo', 'y', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
963 def update(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
964 """Enter event loop until all pending events have been processed by Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
965 self.tk.call('update') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
966 def update_idletasks(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
967 """Enter event loop until all idle callbacks have been called. This |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
968 will update the display of windows but not process events caused by |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
969 the user.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
970 self.tk.call('update', 'idletasks') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
971 def bindtags(self, tagList=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
972 """Set or get the list of bindtags for this widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
973 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
974 With no argument return the list of all bindtags associated with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
975 this widget. With a list of strings as argument the bindtags are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
976 set to this list. The bindtags determine in which order events are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
977 processed (see bind).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
978 if tagList is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
979 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
980 self.tk.call('bindtags', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
981 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
982 self.tk.call('bindtags', self._w, tagList) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
983 def _bind(self, what, sequence, func, add, needcleanup=1): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
984 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
985 if isinstance(func, str): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
986 self.tk.call(what + (sequence, func)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
987 elif func: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
988 funcid = self._register(func, self._substitute, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
989 needcleanup) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
990 cmd = ('%sif {"[%s %s]" == "break"} break\n' |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
991 % |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
992 (add and '+' or '', |
|
19102
9ec5611cfe9c
Patch #403514: precompute _subst_format_str to avoid a call to
Martin v. Löwis <martin@v.loewis.de>
parents:
16517
diff
changeset
|
993 funcid, self._subst_format_str)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
994 self.tk.call(what + (sequence, cmd)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
995 return funcid |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
996 elif sequence: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
997 return self.tk.call(what + (sequence,)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
998 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
999 return self.tk.splitlist(self.tk.call(what)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1000 def bind(self, sequence=None, func=None, add=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1001 """Bind to this widget at event SEQUENCE a call to function FUNC. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1002 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1003 SEQUENCE is a string of concatenated event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1004 patterns. An event pattern is of the form |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1005 <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1006 of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1007 Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1008 B3, Alt, Button4, B4, Double, Button5, B5 Triple, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1009 Mod1, M1. TYPE is one of Activate, Enter, Map, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1010 ButtonPress, Button, Expose, Motion, ButtonRelease |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1011 FocusIn, MouseWheel, Circulate, FocusOut, Property, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1012 Colormap, Gravity Reparent, Configure, KeyPress, Key, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1013 Unmap, Deactivate, KeyRelease Visibility, Destroy, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1014 Leave and DETAIL is the button number for ButtonPress, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1015 ButtonRelease and DETAIL is the Keysym for KeyPress and |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1016 KeyRelease. Examples are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1017 <Control-Button-1> for pressing Control and mouse button 1 or |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1018 <Alt-A> for pressing A and the Alt key (KeyPress can be omitted). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1019 An event pattern can also be a virtual event of the form |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1020 <<AString>> where AString can be arbitrary. This |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1021 event can be generated by event_generate. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1022 If events are concatenated they must appear shortly |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1023 after each other. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1024 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1025 FUNC will be called if the event sequence occurs with an |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1026 instance of Event as argument. If the return value of FUNC is |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1027 "break" no further bound function is invoked. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1028 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1029 An additional boolean parameter ADD specifies whether FUNC will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1030 be called additionally to the other bound function or whether |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1031 it will replace the previous function. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1032 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1033 Bind will return an identifier to allow deletion of the bound function with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1034 unbind without memory leak. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1035 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1036 If FUNC or SEQUENCE is omitted the bound function or list |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1037 of bound events are returned.""" |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1038 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1039 return self._bind(('bind', self._w), sequence, func, add) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1040 def unbind(self, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1041 """Unbind for this widget for event SEQUENCE the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1042 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1043 self.tk.call('bind', self._w, sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1044 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1045 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1046 def bind_all(self, sequence=None, func=None, add=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1047 """Bind to all widgets at an event SEQUENCE a call to function FUNC. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1048 An additional boolean parameter ADD specifies whether FUNC will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1049 be called additionally to the other bound function or whether |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1050 it will replace the previous function. See bind for the return value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1051 return self._bind(('bind', 'all'), sequence, func, add, 0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1052 def unbind_all(self, sequence): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1053 """Unbind for all widgets for event SEQUENCE all functions.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1054 self.tk.call('bind', 'all' , sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1055 def bind_class(self, className, sequence=None, func=None, add=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1056 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1057 """Bind to widgets with bindtag CLASSNAME at event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1058 SEQUENCE a call of function FUNC. An additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1059 boolean parameter ADD specifies whether FUNC will be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1060 called additionally to the other bound function or |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1061 whether it will replace the previous function. See bind for |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1062 the return value.""" |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1063 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1064 return self._bind(('bind', className), sequence, func, add, 0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1065 def unbind_class(self, className, sequence): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1066 """Unbind for a all widgets with bindtag CLASSNAME for event SEQUENCE |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1067 all functions.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1068 self.tk.call('bind', className , sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1069 def mainloop(self, n=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1070 """Call the mainloop of Tk.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1071 self.tk.mainloop(n) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1072 def quit(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1073 """Quit the Tcl interpreter. All widgets will be destroyed.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1074 self.tk.quit() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1075 def _getints(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1076 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1077 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1078 return tuple(map(getint, self.tk.splitlist(string))) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1079 def _getdoubles(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1080 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1081 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1082 return tuple(map(getdouble, self.tk.splitlist(string))) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1083 def _getboolean(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1084 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1085 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1086 return self.tk.getboolean(string) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1087 def _displayof(self, displayof): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1088 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1089 if displayof: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1090 return ('-displayof', displayof) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1091 if displayof is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1092 return ('-displayof', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1093 return () |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1094 @property |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1095 def _windowingsystem(self): |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1096 """Internal function.""" |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1097 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1098 return self._root()._windowingsystem_cached |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1099 except AttributeError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1100 ws = self._root()._windowingsystem_cached = \ |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1101 self.tk.call('tk', 'windowingsystem') |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1102 return ws |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1103 def _options(self, cnf, kw = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1104 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1105 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1106 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1107 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1108 cnf = _cnfmerge(cnf) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1109 res = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1110 for k, v in cnf.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1111 if v is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1112 if k[-1] == '_': k = k[:-1] |
|
73165
8e57b5d8f58f
Closes #13258: Use callable() built-in in the standard library.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
68489
diff
changeset
|
1113 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1114 v = self._register(v) |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1115 elif isinstance(v, (tuple, list)): |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1116 nv = [] |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1117 for item in v: |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1118 if isinstance(item, int): |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1119 nv.append(str(item)) |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1120 elif isinstance(item, str): |
|
81527
411bb75be5d1
Issue #15861: tkinter now correctly works with lists and tuples containing
Serhiy Storchaka <storchaka@gmail.com>
parents:
81219
diff
changeset
|
1121 nv.append(_stringify(item)) |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1122 else: |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1123 break |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1124 else: |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1125 v = ' '.join(nv) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1126 res = res + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1127 return res |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1128 def nametowidget(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1129 """Return the Tkinter instance of a widget identified by |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1130 its Tcl name NAME.""" |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1131 name = str(name).split('.') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1132 w = self |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1133 |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1134 if not name[0]: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1135 w = w._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1136 name = name[1:] |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1137 |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1138 for n in name: |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1139 if not n: |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1140 break |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1141 w = w.children[n] |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1142 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1143 return w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1144 _nametowidget = nametowidget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1145 def _register(self, func, subst=None, needcleanup=1): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1146 """Return a newly created Tcl function. If this |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1147 function is called, the Python function FUNC will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1148 be executed. An optional function SUBST can |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1149 be given which will be executed before FUNC.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1150 f = CallWrapper(func, subst, self).__call__ |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
1151 name = repr(id(f)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1152 try: |
|
44026
48af6375207e
Removed the API to create unbound methods and simplified the API for bound methods. The signature is PyMethod_New(func, instance).
Christian Heimes <christian@cheimes.de>
parents:
43577
diff
changeset
|
1153 func = func.__func__ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1154 except AttributeError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1155 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1156 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1157 name = name + func.__name__ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1158 except AttributeError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1159 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1160 self.tk.createcommand(name, f) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1161 if needcleanup: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1162 if self._tclCommands is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1163 self._tclCommands = [] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1164 self._tclCommands.append(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1165 return name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1166 register = _register |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1167 def _root(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1168 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1169 w = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1170 while w.master: w = w.master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1171 return w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1172 _subst_format = ('%#', '%b', '%f', '%h', '%k', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1173 '%s', '%t', '%w', '%x', '%y', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1174 '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y', '%D') |
|
19102
9ec5611cfe9c
Patch #403514: precompute _subst_format_str to avoid a call to
Martin v. Löwis <martin@v.loewis.de>
parents:
16517
diff
changeset
|
1175 _subst_format_str = " ".join(_subst_format) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1176 def _substitute(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1177 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1178 if len(args) != len(self._subst_format): return args |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1179 getboolean = self.tk.getboolean |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1180 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1181 getint = int |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1182 def getint_event(s): |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1183 """Tk changed behavior in 8.4.2, returning "??" rather more often.""" |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1184 try: |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1185 return int(s) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1186 except ValueError: |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1187 return s |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1188 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1189 nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1190 # Missing: (a, c, d, m, o, v, B, R) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1191 e = Event() |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1192 # serial field: valid vor all events |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1193 # number of button: ButtonPress and ButtonRelease events only |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1194 # height field: Configure, ConfigureRequest, Create, |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1195 # ResizeRequest, and Expose events only |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1196 # keycode field: KeyPress and KeyRelease events only |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1197 # time field: "valid for events that contain a time field" |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1198 # width field: Configure, ConfigureRequest, Create, ResizeRequest, |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1199 # and Expose events only |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1200 # x field: "valid for events that contain a x field" |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1201 # y field: "valid for events that contain a y field" |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1202 # keysym as decimal: KeyPress and KeyRelease events only |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1203 # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress, |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1204 # KeyRelease,and Motion events |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1205 e.serial = getint(nsign) |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1206 e.num = getint_event(b) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1207 try: e.focus = getboolean(f) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1208 except TclError: pass |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1209 e.height = getint_event(h) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1210 e.keycode = getint_event(k) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1211 e.state = getint_event(s) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1212 e.time = getint_event(t) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1213 e.width = getint_event(w) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1214 e.x = getint_event(x) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1215 e.y = getint_event(y) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1216 e.char = A |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1217 try: e.send_event = getboolean(E) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1218 except TclError: pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1219 e.keysym = K |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1220 e.keysym_num = getint_event(N) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1221 e.type = T |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1222 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1223 e.widget = self._nametowidget(W) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1224 except KeyError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1225 e.widget = W |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1226 e.x_root = getint_event(X) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1227 e.y_root = getint_event(Y) |
|
14453
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1228 try: |
|
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1229 e.delta = getint(D) |
|
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1230 except ValueError: |
|
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1231 e.delta = 0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1232 return (e,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1233 def _report_exception(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1234 """Internal function.""" |
|
37042
7ada16a14968
Remove sys.exc_type, sys.exc_value, sys.exc_traceback
Neal Norwitz <nnorwitz@gmail.com>
parents:
35850
diff
changeset
|
1235 exc, val, tb = sys.exc_info() |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1236 root = self._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1237 root.report_callback_exception(exc, val, tb) |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1238 def _configure(self, cmd, cnf, kw): |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1239 """Internal function.""" |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1240 if kw: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1241 cnf = _cnfmerge((cnf, kw)) |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1242 elif cnf: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1243 cnf = _cnfmerge(cnf) |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1244 if cnf is None: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1245 cnf = {} |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1246 for x in self.tk.split( |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1247 self.tk.call(_flatten((self._w, cmd)))): |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1248 cnf[x[0][1:]] = (x[0][1:],) + x[1:] |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1249 return cnf |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
1250 if isinstance(cnf, str): |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1251 x = self.tk.split( |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1252 self.tk.call(_flatten((self._w, cmd, '-'+cnf)))) |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1253 return (x[0][1:],) + x[1:] |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1254 self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1255 # These used to be defined in Widget: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1256 def configure(self, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1257 """Configure resources of a widget. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1258 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1259 The values for resources are specified as keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1260 arguments. To get an overview about |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1261 the allowed keyword arguments call the method keys. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1262 """ |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1263 return self._configure('configure', cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1264 config = configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1265 def cget(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1266 """Return the resource value for a KEY given as string.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1267 return self.tk.call(self._w, 'cget', '-' + key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1268 __getitem__ = cget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1269 def __setitem__(self, key, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1270 self.configure({key: value}) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1271 def keys(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1272 """Return a list of all resource names of this widget.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1273 return [x[0][1:] for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1274 self.tk.split(self.tk.call(self._w, 'configure'))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1275 def __str__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1276 """Return the window path name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1277 return self._w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1278 # Pack methods that apply to the master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1279 _noarg_ = ['_noarg_'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1280 def pack_propagate(self, flag=_noarg_): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1281 """Set or get the status for propagation of geometry information. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1282 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1283 A boolean argument specifies whether the geometry information |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1284 of the slaves will determine the size of this widget. If no argument |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1285 is given the current setting will be returned. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1286 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1287 if flag is Misc._noarg_: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1288 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1289 'pack', 'propagate', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1290 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1291 self.tk.call('pack', 'propagate', self._w, flag) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1292 propagate = pack_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1293 def pack_slaves(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1294 """Return a list of all slaves of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1295 in its packing order.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1296 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1297 self.tk.splitlist( |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1298 self.tk.call('pack', 'slaves', self._w))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1299 slaves = pack_slaves |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1300 # Place method that applies to the master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1301 def place_slaves(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1302 """Return a list of all slaves of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1303 in its packing order.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1304 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1305 self.tk.splitlist( |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1306 self.tk.call( |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1307 'place', 'slaves', self._w))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1308 # Grid methods that apply to the master |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1309 def grid_anchor(self, anchor=None): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1310 """The anchor value controls how to place the grid within the |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1311 master when no row/column has any weight. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1312 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1313 The default anchor is nw.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1314 self.tk.call('grid', 'anchor', self._w, anchor) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1315 anchor = grid_anchor |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1316 def grid_bbox(self, column=None, row=None, col2=None, row2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1317 """Return a tuple of integer coordinates for the bounding |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1318 box of this widget controlled by the geometry manager grid. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1319 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1320 If COLUMN, ROW is given the bounding box applies from |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1321 the cell with row and column 0 to the specified |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1322 cell. If COL2 and ROW2 are given the bounding box |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1323 starts at that cell. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1324 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1325 The returned integers specify the offset of the upper left |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1326 corner in the master widget and the width and height. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1327 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1328 args = ('grid', 'bbox', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1329 if column is not None and row is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1330 args = args + (column, row) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1331 if col2 is not None and row2 is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1332 args = args + (col2, row2) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1333 return self._getints(self.tk.call(*args)) or None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1334 bbox = grid_bbox |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1335 def _grid_configure(self, command, index, cnf, kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1336 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
1337 if isinstance(cnf, str) and not kw: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1338 if cnf[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1339 cnf = cnf[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1340 if cnf[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1341 cnf = '-'+cnf |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1342 options = (cnf,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1343 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1344 options = self._options(cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1345 if not options: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1346 res = self.tk.call('grid', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1347 command, self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1348 words = self.tk.splitlist(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1349 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1350 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1351 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1352 value = words[i+1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1353 if not value: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1354 value = None |
|
85326
516b0cd87a90
Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6.
Serhiy Storchaka <storchaka@gmail.com>
parents:
82621
diff
changeset
|
1355 elif '.' in str(value): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1356 value = getdouble(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1357 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1358 value = getint(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1359 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1360 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1361 res = self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1362 ('grid', command, self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1363 + options) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1364 if len(options) == 1: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1365 if not res: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1366 # In Tk 7.5, -width can be a float |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1367 if '.' in res: return getdouble(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1368 return getint(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1369 def grid_columnconfigure(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1370 """Configure column INDEX of a grid. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1371 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1372 Valid resources are minsize (minimum size of the column), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1373 weight (how much does additional space propagate to this column) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1374 and pad (how much space to let additionally).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1375 return self._grid_configure('columnconfigure', index, cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1376 columnconfigure = grid_columnconfigure |
|
20414
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1377 def grid_location(self, x, y): |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1378 """Return a tuple of column and row which identify the cell |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1379 at which the pixel at position X and Y inside the master |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1380 widget is located.""" |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1381 return self._getints( |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1382 self.tk.call( |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1383 'grid', 'location', self._w, x, y)) or None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1384 def grid_propagate(self, flag=_noarg_): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1385 """Set or get the status for propagation of geometry information. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1386 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1387 A boolean argument specifies whether the geometry information |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1388 of the slaves will determine the size of this widget. If no argument |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1389 is given, the current setting will be returned. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1390 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1391 if flag is Misc._noarg_: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1392 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1393 'grid', 'propagate', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1394 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1395 self.tk.call('grid', 'propagate', self._w, flag) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1396 def grid_rowconfigure(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1397 """Configure row INDEX of a grid. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1398 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1399 Valid resources are minsize (minimum size of the row), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1400 weight (how much does additional space propagate to this row) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1401 and pad (how much space to let additionally).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1402 return self._grid_configure('rowconfigure', index, cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1403 rowconfigure = grid_rowconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1404 def grid_size(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1405 """Return a tuple of the number of column and rows in the grid.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1406 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1407 self.tk.call('grid', 'size', self._w)) or None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1408 size = grid_size |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1409 def grid_slaves(self, row=None, column=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1410 """Return a list of all slaves of this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1411 in its packing order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1412 args = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1413 if row is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1414 args = args + ('-row', row) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1415 if column is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1416 args = args + ('-column', column) |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1417 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1418 self.tk.splitlist(self.tk.call( |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1419 ('grid', 'slaves', self._w) + args))] |
| 1664 | 1420 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1421 # Support for the "event" command, new in Tk 4.2. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1422 # By Case Roole. |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1423 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1424 def event_add(self, virtual, *sequences): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1425 """Bind a virtual event VIRTUAL (of the form <<Name>>) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1426 to an event SEQUENCE such that the virtual event is triggered |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1427 whenever SEQUENCE occurs.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1428 args = ('event', 'add', virtual) + sequences |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1429 self.tk.call(args) |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1430 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1431 def event_delete(self, virtual, *sequences): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1432 """Unbind a virtual event VIRTUAL from SEQUENCE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1433 args = ('event', 'delete', virtual) + sequences |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1434 self.tk.call(args) |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1435 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1436 def event_generate(self, sequence, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1437 """Generate an event SEQUENCE. Additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1438 keyword arguments specify parameter of the event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1439 (e.g. x, y, rootx, rooty).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1440 args = ('event', 'generate', self._w, sequence) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1441 for k, v in kw.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1442 args = args + ('-%s' % k, str(v)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1443 self.tk.call(args) |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1444 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1445 def event_info(self, virtual=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1446 """Return a list of all virtual events or the information |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1447 about the SEQUENCE bound to the virtual event VIRTUAL.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1448 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1449 self.tk.call('event', 'info', virtual)) |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1450 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1451 # Image related commands |
|
7959
fec8eb2a380d
Add image_types() and image_names() as methods to Misc class.
Guido van Rossum <guido@python.org>
parents:
7880
diff
changeset
|
1452 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1453 def image_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1454 """Return a list of all existing image names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1455 return self.tk.call('image', 'names') |
|
7959
fec8eb2a380d
Add image_types() and image_names() as methods to Misc class.
Guido van Rossum <guido@python.org>
parents:
7880
diff
changeset
|
1456 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1457 def image_types(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1458 """Return a list of all available image types (e.g. phote bitmap).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1459 return self.tk.call('image', 'types') |
|
7959
fec8eb2a380d
Add image_types() and image_names() as methods to Misc class.
Guido van Rossum <guido@python.org>
parents:
7880
diff
changeset
|
1460 |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1461 |
|
3071
fbb8eddc9309
move constants to Tkconstants; added some; overridable error reporting; fix typo in propagate
Guido van Rossum <guido@python.org>
parents:
3067
diff
changeset
|
1462 class CallWrapper: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1463 """Internal class. Stores function to call when some user |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1464 defined Tcl function is called e.g. after an event occurred.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1465 def __init__(self, func, subst, widget): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1466 """Store FUNC, SUBST and WIDGET as members.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1467 self.func = func |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1468 self.subst = subst |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1469 self.widget = widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1470 def __call__(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1471 """Apply first function SUBST to arguments, than FUNC.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1472 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1473 if self.subst: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1474 args = self.subst(*args) |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1475 return self.func(*args) |
|
80707
b742bbf6b07f
Issue #16583: Prevent nesting SystemExit in tkinter.CallWrapper
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
76975
diff
changeset
|
1476 except SystemExit: |
|
b742bbf6b07f
Issue #16583: Prevent nesting SystemExit in tkinter.CallWrapper
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
76975
diff
changeset
|
1477 raise |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1478 except: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1479 self.widget._report_exception() |
| 1664 | 1480 |
|
8211
203e2ab63936
Change the names of all methods in the Wm class: they are now
Guido van Rossum <guido@python.org>
parents:
8209
diff
changeset
|
1481 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1482 class XView: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1483 """Mix-in class for querying and changing the horizontal position |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1484 of a widget's window.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1485 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1486 def xview(self, *args): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1487 """Query and change the horizontal position of the view.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1488 res = self.tk.call(self._w, 'xview', *args) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1489 if not args: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1490 return self._getdoubles(res) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1491 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1492 def xview_moveto(self, fraction): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1493 """Adjusts the view in the window so that FRACTION of the |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1494 total width of the canvas is off-screen to the left.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1495 self.tk.call(self._w, 'xview', 'moveto', fraction) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1496 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1497 def xview_scroll(self, number, what): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1498 """Shift the x-view according to NUMBER which is measured in "units" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1499 or "pages" (WHAT).""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1500 self.tk.call(self._w, 'xview', 'scroll', number, what) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1501 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1502 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1503 class YView: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1504 """Mix-in class for querying and changing the vertical position |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1505 of a widget's window.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1506 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1507 def yview(self, *args): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1508 """Query and change the vertical position of the view.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1509 res = self.tk.call(self._w, 'yview', *args) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1510 if not args: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1511 return self._getdoubles(res) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1512 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1513 def yview_moveto(self, fraction): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1514 """Adjusts the view in the window so that FRACTION of the |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1515 total height of the canvas is off-screen to the top.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1516 self.tk.call(self._w, 'yview', 'moveto', fraction) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1517 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1518 def yview_scroll(self, number, what): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1519 """Shift the y-view according to NUMBER which is measured in |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1520 "units" or "pages" (WHAT).""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1521 self.tk.call(self._w, 'yview', 'scroll', number, what) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1522 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1523 |
| 1664 | 1524 class Wm: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1525 """Provides functions for the communication with the window manager.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1526 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1527 def wm_aspect(self, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1528 minNumer=None, minDenom=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1529 maxNumer=None, maxDenom=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1530 """Instruct the window manager to set the aspect ratio (width/height) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1531 of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1532 of the actual values if no argument is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1533 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1534 self.tk.call('wm', 'aspect', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1535 minNumer, minDenom, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1536 maxNumer, maxDenom)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1537 aspect = wm_aspect |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1538 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1539 def wm_attributes(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1540 """This subcommand returns or sets platform specific attributes |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1541 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1542 The first form returns a list of the platform specific flags and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1543 their values. The second form returns the value for the specific |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1544 option. The third form sets one or more of the values. The values |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1545 are as follows: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1546 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1547 On Windows, -disabled gets or sets whether the window is in a |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1548 disabled state. -toolwindow gets or sets the style of the window |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1549 to toolwindow (as defined in the MSDN). -topmost gets or sets |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1550 whether this is a topmost window (displays above all other |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1551 windows). |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1552 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1553 On Macintosh, XXXXX |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1554 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1555 On Unix, there are currently no special attribute values. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1556 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1557 args = ('wm', 'attributes', self._w) + args |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1558 return self.tk.call(args) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1559 attributes=wm_attributes |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1560 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1561 def wm_client(self, name=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1562 """Store NAME in WM_CLIENT_MACHINE property of this widget. Return |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1563 current value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1564 return self.tk.call('wm', 'client', self._w, name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1565 client = wm_client |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1566 def wm_colormapwindows(self, *wlist): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1567 """Store list of window names (WLIST) into WM_COLORMAPWINDOWS property |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1568 of this widget. This list contains windows whose colormaps differ from their |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1569 parents. Return current list of widgets if WLIST is empty.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1570 if len(wlist) > 1: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1571 wlist = (wlist,) # Tk needs a list of windows here |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1572 args = ('wm', 'colormapwindows', self._w) + wlist |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1573 return [self._nametowidget(x) for x in self.tk.call(args)] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1574 colormapwindows = wm_colormapwindows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1575 def wm_command(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1576 """Store VALUE in WM_COMMAND property. It is the command |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1577 which shall be used to invoke the application. Return current |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1578 command if VALUE is None.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1579 return self.tk.call('wm', 'command', self._w, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1580 command = wm_command |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1581 def wm_deiconify(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1582 """Deiconify this widget. If it was never mapped it will not be mapped. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1583 On Windows it will raise this widget and give it the focus.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1584 return self.tk.call('wm', 'deiconify', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1585 deiconify = wm_deiconify |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1586 def wm_focusmodel(self, model=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1587 """Set focus model to MODEL. "active" means that this widget will claim |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1588 the focus itself, "passive" means that the window manager shall give |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1589 the focus. Return current focus model if MODEL is None.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1590 return self.tk.call('wm', 'focusmodel', self._w, model) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1591 focusmodel = wm_focusmodel |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1592 def wm_forget(self, window): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1593 """The window will be unmappend from the screen and will no longer |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1594 be managed by wm. toplevel windows will be treated like frame |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1595 windows once they are no longer managed by wm, however, the menu |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1596 option configuration will be remembered and the menus will return |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1597 once the widget is managed again.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1598 self.tk.call('wm', 'forget', window) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1599 forget = wm_forget |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1600 def wm_frame(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1601 """Return identifier for decorative frame of this widget if present.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1602 return self.tk.call('wm', 'frame', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1603 frame = wm_frame |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1604 def wm_geometry(self, newGeometry=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1605 """Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1606 current value if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1607 return self.tk.call('wm', 'geometry', self._w, newGeometry) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1608 geometry = wm_geometry |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1609 def wm_grid(self, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1610 baseWidth=None, baseHeight=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1611 widthInc=None, heightInc=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1612 """Instruct the window manager that this widget shall only be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1613 resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1614 height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1615 number of grid units requested in Tk_GeometryRequest.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1616 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1617 'wm', 'grid', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1618 baseWidth, baseHeight, widthInc, heightInc)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1619 grid = wm_grid |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1620 def wm_group(self, pathName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1621 """Set the group leader widgets for related widgets to PATHNAME. Return |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1622 the group leader of this widget if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1623 return self.tk.call('wm', 'group', self._w, pathName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1624 group = wm_group |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1625 def wm_iconbitmap(self, bitmap=None, default=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1626 """Set bitmap for the iconified widget to BITMAP. Return |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1627 the bitmap if None is given. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1628 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1629 Under Windows, the DEFAULT parameter can be used to set the icon |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1630 for the widget and any descendents that don't have an icon set |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1631 explicitly. DEFAULT can be the relative path to a .ico file |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1632 (example: root.iconbitmap(default='myicon.ico') ). See Tk |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1633 documentation for more information.""" |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1634 if default: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1635 return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1636 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1637 return self.tk.call('wm', 'iconbitmap', self._w, bitmap) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1638 iconbitmap = wm_iconbitmap |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1639 def wm_iconify(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1640 """Display widget as icon.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1641 return self.tk.call('wm', 'iconify', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1642 iconify = wm_iconify |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1643 def wm_iconmask(self, bitmap=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1644 """Set mask for the icon bitmap of this widget. Return the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1645 mask if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1646 return self.tk.call('wm', 'iconmask', self._w, bitmap) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1647 iconmask = wm_iconmask |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1648 def wm_iconname(self, newName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1649 """Set the name of the icon for this widget. Return the name if |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1650 None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1651 return self.tk.call('wm', 'iconname', self._w, newName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1652 iconname = wm_iconname |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1653 def wm_iconphoto(self, default=False, *args): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1654 """Sets the titlebar icon for this window based on the named photo |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1655 images passed through args. If default is True, this is applied to |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1656 all future created toplevels as well. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1657 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1658 The data in the images is taken as a snapshot at the time of |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1659 invocation. If the images are later changed, this is not reflected |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1660 to the titlebar icons. Multiple images are accepted to allow |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1661 different images sizes to be provided. The window manager may scale |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1662 provided icons to an appropriate size. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1663 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1664 On Windows, the images are packed into a Windows icon structure. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1665 This will override an icon specified to wm_iconbitmap, and vice |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1666 versa. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1667 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1668 On X, the images are arranged into the _NET_WM_ICON X property, |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1669 which most modern window managers support. An icon specified by |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1670 wm_iconbitmap may exist simuultaneously. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1671 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1672 On Macintosh, this currently does nothing.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1673 if default: |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1674 self.tk.call('wm', 'iconphoto', self._w, "-default", *args) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1675 else: |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1676 self.tk.call('wm', 'iconphoto', self._w, *args) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1677 iconphoto = wm_iconphoto |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1678 def wm_iconposition(self, x=None, y=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1679 """Set the position of the icon of this widget to X and Y. Return |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1680 a tuple of the current values of X and X if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1681 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1682 'wm', 'iconposition', self._w, x, y)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1683 iconposition = wm_iconposition |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1684 def wm_iconwindow(self, pathName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1685 """Set widget PATHNAME to be displayed instead of icon. Return the current |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1686 value if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1687 return self.tk.call('wm', 'iconwindow', self._w, pathName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1688 iconwindow = wm_iconwindow |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1689 def wm_manage(self, widget): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1690 """The widget specified will become a stand alone top-level window. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1691 The window will be decorated with the window managers title bar, |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1692 etc.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1693 self.tk.call('wm', 'manage', widget) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
1694 manage = wm_manage |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1695 def wm_maxsize(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1696 """Set max WIDTH and HEIGHT for this widget. If the window is gridded |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1697 the values are given in grid units. Return the current values if None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1698 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1699 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1700 'wm', 'maxsize', self._w, width, height)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1701 maxsize = wm_maxsize |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1702 def wm_minsize(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1703 """Set min WIDTH and HEIGHT for this widget. If the window is gridded |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1704 the values are given in grid units. Return the current values if None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1705 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1706 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1707 'wm', 'minsize', self._w, width, height)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1708 minsize = wm_minsize |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1709 def wm_overrideredirect(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1710 """Instruct the window manager to ignore this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1711 if BOOLEAN is given with 1. Return the current value if None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1712 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1713 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1714 'wm', 'overrideredirect', self._w, boolean)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1715 overrideredirect = wm_overrideredirect |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1716 def wm_positionfrom(self, who=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1717 """Instruct the window manager that the position of this widget shall |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1718 be defined by the user if WHO is "user", and by its own policy if WHO is |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1719 "program".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1720 return self.tk.call('wm', 'positionfrom', self._w, who) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1721 positionfrom = wm_positionfrom |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1722 def wm_protocol(self, name=None, func=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1723 """Bind function FUNC to command NAME for this widget. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1724 Return the function bound to NAME if None is given. NAME could be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1725 e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".""" |
|
73165
8e57b5d8f58f
Closes #13258: Use callable() built-in in the standard library.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
68489
diff
changeset
|
1726 if callable(func): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1727 command = self._register(func) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1728 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1729 command = func |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1730 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1731 'wm', 'protocol', self._w, name, command) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1732 protocol = wm_protocol |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1733 def wm_resizable(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1734 """Instruct the window manager whether this width can be resized |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1735 in WIDTH or HEIGHT. Both values are boolean values.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1736 return self.tk.call('wm', 'resizable', self._w, width, height) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1737 resizable = wm_resizable |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1738 def wm_sizefrom(self, who=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1739 """Instruct the window manager that the size of this widget shall |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1740 be defined by the user if WHO is "user", and by its own policy if WHO is |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1741 "program".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1742 return self.tk.call('wm', 'sizefrom', self._w, who) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1743 sizefrom = wm_sizefrom |
|
13906
c45accc8e6d0
-- added optional newstate argument to Wm.state. The newstate arg
Fredrik Lundh <fredrik@pythonware.com>
parents:
13905
diff
changeset
|
1744 def wm_state(self, newstate=None): |
|
c45accc8e6d0
-- added optional newstate argument to Wm.state. The newstate arg
Fredrik Lundh <fredrik@pythonware.com>
parents:
13905
diff
changeset
|
1745 """Query or set the state of this widget as one of normal, icon, |
|
c45accc8e6d0
-- added optional newstate argument to Wm.state. The newstate arg
Fredrik Lundh <fredrik@pythonware.com>
parents:
13905
diff
changeset
|
1746 iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).""" |
|
c45accc8e6d0
-- added optional newstate argument to Wm.state. The newstate arg
Fredrik Lundh <fredrik@pythonware.com>
parents:
13905
diff
changeset
|
1747 return self.tk.call('wm', 'state', self._w, newstate) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1748 state = wm_state |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1749 def wm_title(self, string=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1750 """Set the title of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1751 return self.tk.call('wm', 'title', self._w, string) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1752 title = wm_title |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1753 def wm_transient(self, master=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1754 """Instruct the window manager that this widget is transient |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1755 with regard to widget MASTER.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1756 return self.tk.call('wm', 'transient', self._w, master) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1757 transient = wm_transient |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1758 def wm_withdraw(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1759 """Withdraw this widget from the screen such that it is unmapped |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1760 and forgotten by the window manager. Re-draw it with wm_deiconify.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1761 return self.tk.call('wm', 'withdraw', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1762 withdraw = wm_withdraw |
|
8211
203e2ab63936
Change the names of all methods in the Wm class: they are now
Guido van Rossum <guido@python.org>
parents:
8209
diff
changeset
|
1763 |
| 1664 | 1764 |
| 1765 class Tk(Misc, Wm): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1766 """Toplevel widget of Tk which represents mostly the main window |
|
68488
0991b40e895d
#11515: fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
66407
diff
changeset
|
1767 of an application. It has an associated Tcl interpreter.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1768 _w = '.' |
|
32941
66dc211bf507
Patch #986929: Add support for wish -sync and -use options.
Martin v. Löwis <martin@v.loewis.de>
parents:
32736
diff
changeset
|
1769 def __init__(self, screenName=None, baseName=None, className='Tk', |
|
66dc211bf507
Patch #986929: Add support for wish -sync and -use options.
Martin v. Löwis <martin@v.loewis.de>
parents:
32736
diff
changeset
|
1770 useTk=1, sync=0, use=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1771 """Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1772 be created. BASENAME will be used for the identification of the profile file (see |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1773 readprofile). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1774 It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1775 is the name of the widget class.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1776 self.master = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1777 self.children = {} |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1778 self._tkloaded = 0 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1779 # to avoid recursions in the getattr code in case of failure, we |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1780 # ensure that self.tk is always _something_. |
|
32736
c3a096bfbd6b
Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents:
31547
diff
changeset
|
1781 self.tk = None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1782 if baseName is None: |
|
85718
c39f42f46a05
Fix tkinter regression introduced by the security fix in #16248.
Georg Brandl <georg@python.org>
parents:
80782
diff
changeset
|
1783 import os |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1784 baseName = os.path.basename(sys.argv[0]) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1785 baseName, ext = os.path.splitext(baseName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1786 if ext not in ('.py', '.pyc', '.pyo'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1787 baseName = baseName + ext |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1788 interactive = 0 |
|
32941
66dc211bf507
Patch #986929: Add support for wish -sync and -use options.
Martin v. Löwis <martin@v.loewis.de>
parents:
32736
diff
changeset
|
1789 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1790 if useTk: |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1791 self._loadtk() |
|
80782
03b3124e9ea3
Issue #16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python.
Antoine Pitrou <solipsis@pitrou.net>
parents:
68488
diff
changeset
|
1792 if not sys.flags.ignore_environment: |
|
03b3124e9ea3
Issue #16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python.
Antoine Pitrou <solipsis@pitrou.net>
parents:
68488
diff
changeset
|
1793 # Issue #16248: Honor the -E flag to avoid code injection. |
|
03b3124e9ea3
Issue #16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python.
Antoine Pitrou <solipsis@pitrou.net>
parents:
68488
diff
changeset
|
1794 self.readprofile(baseName, className) |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1795 def loadtk(self): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1796 if not self._tkloaded: |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1797 self.tk.loadtk() |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1798 self._loadtk() |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1799 def _loadtk(self): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1800 self._tkloaded = 1 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1801 global _default_root |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1802 # Version sanity checks |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1803 tk_version = self.tk.getvar('tk_version') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1804 if tk_version != _tkinter.TK_VERSION: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1805 raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)" |
|
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1806 % (_tkinter.TK_VERSION, tk_version)) |
|
29248
2f42875d937f
Convert tcl_version to str before comparing. Fixes #729317.
Martin v. Löwis <martin@v.loewis.de>
parents:
28645
diff
changeset
|
1807 # Under unknown circumstances, tcl_version gets coerced to float |
|
2f42875d937f
Convert tcl_version to str before comparing. Fixes #729317.
Martin v. Löwis <martin@v.loewis.de>
parents:
28645
diff
changeset
|
1808 tcl_version = str(self.tk.getvar('tcl_version')) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1809 if tcl_version != _tkinter.TCL_VERSION: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1810 raise RuntimeError("tcl.h version (%s) doesn't match libtcl.a version (%s)" \ |
|
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1811 % (_tkinter.TCL_VERSION, tcl_version)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1812 if TkVersion < 4.0: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1813 raise RuntimeError("Tk 4.0 or higher is required; found Tk %s" |
|
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1814 % str(TkVersion)) |
|
34642
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1815 # Create and register the tkerror and exit commands |
|
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1816 # We need to inline parts of _register here, _ register |
|
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1817 # would register differently-named commands. |
|
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1818 if self._tclCommands is None: |
|
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1819 self._tclCommands = [] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1820 self.tk.createcommand('tkerror', _tkerror) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1821 self.tk.createcommand('exit', _exit) |
|
34642
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1822 self._tclCommands.append('tkerror') |
|
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1823 self._tclCommands.append('exit') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1824 if _support_default_root and not _default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1825 _default_root = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1826 self.protocol("WM_DELETE_WINDOW", self.destroy) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1827 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1828 """Destroy this and all descendants widgets. This will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1829 end the application of this Tcl interpreter.""" |
|
42309
bd6acfdb47d2
Merged revisions 56301-56442 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42193
diff
changeset
|
1830 for c in list(self.children.values()): c.destroy() |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1831 self.tk.call('destroy', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1832 Misc.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1833 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1834 if _support_default_root and _default_root is self: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1835 _default_root = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1836 def readprofile(self, baseName, className): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1837 """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1838 the Tcl Interpreter and calls exec on the contents of BASENAME.py and |
|
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1839 CLASSNAME.py if such a file exists in the home directory.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1840 import os |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
1841 if 'HOME' in os.environ: home = os.environ['HOME'] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1842 else: home = os.curdir |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1843 class_tcl = os.path.join(home, '.%s.tcl' % className) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1844 class_py = os.path.join(home, '.%s.py' % className) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1845 base_tcl = os.path.join(home, '.%s.tcl' % baseName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1846 base_py = os.path.join(home, '.%s.py' % baseName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1847 dir = {'self': self} |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
1848 exec('from tkinter import *', dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1849 if os.path.isfile(class_tcl): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1850 self.tk.call('source', class_tcl) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1851 if os.path.isfile(class_py): |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1852 exec(open(class_py).read(), dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1853 if os.path.isfile(base_tcl): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1854 self.tk.call('source', base_tcl) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1855 if os.path.isfile(base_py): |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1856 exec(open(base_py).read(), dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1857 def report_callback_exception(self, exc, val, tb): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1858 """Internal function. It reports exception on sys.stderr.""" |
|
73345
fa82071bb7e1
Remove redundant imports.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
73166
diff
changeset
|
1859 import traceback |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1860 sys.stderr.write("Exception in Tkinter callback\n") |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1861 sys.last_type = exc |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1862 sys.last_value = val |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1863 sys.last_traceback = tb |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1864 traceback.print_exception(exc, val, tb) |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1865 def __getattr__(self, attr): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1866 "Delegate attribute access to the interpreter object" |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1867 return getattr(self.tk, attr) |
| 1664 | 1868 |
| 6571 | 1869 # Ideally, the classes Pack, Place and Grid disappear, the |
| 1870 # pack/place/grid methods are defined on the Widget class, and | |
| 1871 # everybody uses w.pack_whatever(...) instead of Pack.whatever(w, | |
| 1872 # ...), with pack(), place() and grid() being short for | |
| 1873 # pack_configure(), place_configure() and grid_columnconfigure(), and | |
| 1874 # forget() being short for pack_forget(). As a practical matter, I'm | |
| 1875 # afraid that there is too much code out there that may be using the | |
| 1876 # Pack, Place or Grid class, so I leave them intact -- but only as | |
| 1877 # backwards compatibility features. Also note that those methods that | |
| 1878 # take a master as argument (e.g. pack_propagate) have been moved to | |
| 1879 # the Misc class (which now incorporates all methods common between | |
| 1880 # toplevel and interior widgets). Again, for compatibility, these are | |
| 1881 # copied into the Pack, Place or Grid class. | |
| 1882 | |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1883 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1884 def Tcl(screenName=None, baseName=None, className='Tk', useTk=0): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1885 return Tk(screenName, baseName, className, useTk) |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1886 |
| 1664 | 1887 class Pack: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1888 """Geometry manager Pack. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1889 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1890 Base class to use the methods pack_* in every widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1891 def pack_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1892 """Pack a widget in the parent widget. Use as options: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1893 after=widget - pack it after you have packed widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1894 anchor=NSEW (or subset) - position widget according to |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1895 given direction |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1896 before=widget - pack it before you will pack widget |
|
28639
be0d4ec6bf5a
For StringVar results to strings. Document that boolean things are of
Martin v. Löwis <martin@v.loewis.de>
parents:
28513
diff
changeset
|
1897 expand=bool - expand widget if parent size grows |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1898 fill=NONE or X or Y or BOTH - fill widget if widget grows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1899 in=master - use master to contain this widget |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1900 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1901 ipadx=amount - add internal padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1902 ipady=amount - add internal padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1903 padx=amount - add padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1904 pady=amount - add padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1905 side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1906 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1907 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1908 ('pack', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1909 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1910 pack = configure = config = pack_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1911 def pack_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1912 """Unmap this widget and do not use it for the packing order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1913 self.tk.call('pack', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1914 forget = pack_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1915 def pack_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1916 """Return information about the packing options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1917 for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1918 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1919 self.tk.call('pack', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1920 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1921 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1922 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1923 value = words[i+1] |
|
85326
516b0cd87a90
Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6.
Serhiy Storchaka <storchaka@gmail.com>
parents:
82621
diff
changeset
|
1924 if str(value)[:1] == '.': |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1925 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1926 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1927 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1928 info = pack_info |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1929 propagate = pack_propagate = Misc.pack_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1930 slaves = pack_slaves = Misc.pack_slaves |
| 1664 | 1931 |
| 1932 class Place: | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1933 """Geometry manager Place. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1934 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1935 Base class to use the methods place_* in every widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1936 def place_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1937 """Place a widget in the parent widget. Use as options: |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1938 in=master - master relative to which the widget is placed |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1939 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1940 x=amount - locate anchor of this widget at position x of master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1941 y=amount - locate anchor of this widget at position y of master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1942 relx=amount - locate anchor of this widget between 0.0 and 1.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1943 relative to width of master (1.0 is right edge) |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1944 rely=amount - locate anchor of this widget between 0.0 and 1.0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1945 relative to height of master (1.0 is bottom edge) |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1946 anchor=NSEW (or subset) - position anchor according to given direction |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1947 width=amount - width of this widget in pixel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1948 height=amount - height of this widget in pixel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1949 relwidth=amount - width of this widget between 0.0 and 1.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1950 relative to width of master (1.0 is the same width |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1951 as the master) |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1952 relheight=amount - height of this widget between 0.0 and 1.0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1953 relative to height of master (1.0 is the same |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1954 height as the master) |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1955 bordermode="inside" or "outside" - whether to take border width of |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1956 master widget into account |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1957 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1958 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1959 ('place', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1960 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1961 place = configure = config = place_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1962 def place_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1963 """Unmap this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1964 self.tk.call('place', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1965 forget = place_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1966 def place_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1967 """Return information about the placing options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1968 for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1969 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1970 self.tk.call('place', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1971 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1972 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1973 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1974 value = words[i+1] |
|
85326
516b0cd87a90
Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6.
Serhiy Storchaka <storchaka@gmail.com>
parents:
82621
diff
changeset
|
1975 if str(value)[:1] == '.': |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1976 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1977 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1978 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1979 info = place_info |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1980 slaves = place_slaves = Misc.place_slaves |
| 1664 | 1981 |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
1982 class Grid: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1983 """Geometry manager Grid. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1984 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1985 Base class to use the methods grid_* in every widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1986 # Thanks to Masazumi Yoshikawa (yosikawa@isi.edu) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1987 def grid_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1988 """Position a widget in the parent widget in a grid. Use as options: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1989 column=number - use cell identified with given column (starting with 0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1990 columnspan=number - this widget will span several columns |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1991 in=master - use master to contain this widget |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1992 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1993 ipadx=amount - add internal padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1994 ipady=amount - add internal padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1995 padx=amount - add padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1996 pady=amount - add padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1997 row=number - use cell identified with given row (starting with 0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1998 rowspan=number - this widget will span several rows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1999 sticky=NSEW - if cell is larger on which sides will this |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2000 widget stick to the cell boundary |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2001 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2002 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2003 ('grid', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2004 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2005 grid = configure = config = grid_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2006 bbox = grid_bbox = Misc.grid_bbox |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2007 columnconfigure = grid_columnconfigure = Misc.grid_columnconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2008 def grid_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2009 """Unmap this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2010 self.tk.call('grid', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2011 forget = grid_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2012 def grid_remove(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2013 """Unmap this widget but remember the grid options.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2014 self.tk.call('grid', 'remove', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2015 def grid_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2016 """Return information about the options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2017 for positioning this widget in a grid.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2018 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2019 self.tk.call('grid', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2020 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2021 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2022 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2023 value = words[i+1] |
|
85326
516b0cd87a90
Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6.
Serhiy Storchaka <storchaka@gmail.com>
parents:
82621
diff
changeset
|
2024 if str(value)[:1] == '.': |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2025 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2026 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2027 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2028 info = grid_info |
|
20414
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
2029 location = grid_location = Misc.grid_location |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2030 propagate = grid_propagate = Misc.grid_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2031 rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2032 size = grid_size = Misc.grid_size |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2033 slaves = grid_slaves = Misc.grid_slaves |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
2034 |
| 6571 | 2035 class BaseWidget(Misc): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2036 """Internal class.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2037 def _setup(self, master, cnf): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2038 """Internal function. Sets up information about children.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2039 if _support_default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2040 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2041 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2042 if not _default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2043 _default_root = Tk() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2044 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2045 self.master = master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2046 self.tk = master.tk |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2047 name = None |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2048 if 'name' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2049 name = cnf['name'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2050 del cnf['name'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2051 if not name: |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
2052 name = repr(id(self)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2053 self._name = name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2054 if master._w=='.': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2055 self._w = '.' + name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2056 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2057 self._w = master._w + '.' + name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2058 self.children = {} |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2059 if self._name in self.master.children: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2060 self.master.children[self._name].destroy() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2061 self.master.children[self._name] = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2062 def __init__(self, master, widgetName, cnf={}, kw={}, extra=()): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2063 """Construct a widget with the parent widget MASTER, a name WIDGETNAME |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2064 and appropriate options.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2065 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2066 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2067 self.widgetName = widgetName |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2068 BaseWidget._setup(self, master, cnf) |
|
49639
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2069 if self._tclCommands is None: |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2070 self._tclCommands = [] |
|
49013
5c10af8d33f5
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
Guilherme Polo <ggpolo@gmail.com>
parents:
48823
diff
changeset
|
2071 classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)] |
|
5c10af8d33f5
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
Guilherme Polo <ggpolo@gmail.com>
parents:
48823
diff
changeset
|
2072 for k, v in classes: |
|
5c10af8d33f5
Issue #1658: dict size is changing during iteration in tkinter.BaseWidget and
Guilherme Polo <ggpolo@gmail.com>
parents:
48823
diff
changeset
|
2073 del cnf[k] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2074 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2075 (widgetName, self._w) + extra + self._options(cnf)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2076 for k, v in classes: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2077 k.configure(self, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2078 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2079 """Destroy this and all descendants widgets.""" |
|
42193
090588a17490
Merged revisions 56154-56264 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42050
diff
changeset
|
2080 for c in list(self.children.values()): c.destroy() |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2081 self.tk.call('destroy', self._w) |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2082 if self._name in self.master.children: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2083 del self.master.children[self._name] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2084 Misc.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2085 def _do(self, name, args=()): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2086 # XXX Obsolete -- better use self.tk.call directly! |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2087 return self.tk.call((self._w, name) + args) |
| 1664 | 2088 |
| 6571 | 2089 class Widget(BaseWidget, Pack, Place, Grid): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2090 """Internal class. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2091 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2092 Base class for a widget which can be positioned with the geometry managers |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2093 Pack, Place or Grid.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2094 pass |
| 6571 | 2095 |
| 2096 class Toplevel(BaseWidget, Wm): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2097 """Toplevel widget, e.g. for dialogs.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2098 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2099 """Construct a toplevel widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2100 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2101 Valid resource names: background, bd, bg, borderwidth, class, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2102 colormap, container, cursor, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2103 highlightcolor, highlightthickness, menu, relief, screen, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2104 use, visual, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2105 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2106 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2107 extra = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2108 for wmkey in ['screen', 'class_', 'class', 'visual', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2109 'colormap']: |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2110 if wmkey in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2111 val = cnf[wmkey] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2112 # TBD: a hack needed because some keys |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2113 # are not valid as keyword arguments |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2114 if wmkey[-1] == '_': opt = '-'+wmkey[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2115 else: opt = '-'+wmkey |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2116 extra = extra + (opt, val) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2117 del cnf[wmkey] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2118 BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2119 root = self._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2120 self.iconname(root.iconname()) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2121 self.title(root.title()) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2122 self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 1664 | 2123 |
| 2124 class Button(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2125 """Button widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2126 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2127 """Construct a button widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2128 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2129 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2130 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2131 activebackground, activeforeground, anchor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2132 background, bitmap, borderwidth, cursor, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2133 disabledforeground, font, foreground |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2134 highlightbackground, highlightcolor, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2135 highlightthickness, image, justify, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2136 padx, pady, relief, repeatdelay, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2137 repeatinterval, takefocus, text, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2138 textvariable, underline, wraplength |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2139 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2140 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2141 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2142 command, compound, default, height, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2143 overrelief, state, width |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2144 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2145 Widget.__init__(self, master, 'button', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2146 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2147 def tkButtonEnter(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2148 self.tk.call('tkButtonEnter', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2149 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2150 def tkButtonLeave(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2151 self.tk.call('tkButtonLeave', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2152 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2153 def tkButtonDown(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2154 self.tk.call('tkButtonDown', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2155 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2156 def tkButtonUp(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2157 self.tk.call('tkButtonUp', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2158 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2159 def tkButtonInvoke(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2160 self.tk.call('tkButtonInvoke', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2161 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2162 def flash(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2163 """Flash the button. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2164 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2165 This is accomplished by redisplaying |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2166 the button several times, alternating between active and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2167 normal colors. At the end of the flash the button is left |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2168 in the same normal/active state as when the command was |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2169 invoked. This command is ignored if the button's state is |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2170 disabled. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2171 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2172 self.tk.call(self._w, 'flash') |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2173 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2174 def invoke(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2175 """Invoke the command associated with the button. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2176 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2177 The return value is the return value from the command, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2178 or an empty string if there is no command associated with |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2179 the button. This command is ignored if the button's state |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2180 is disabled. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2181 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2182 return self.tk.call(self._w, 'invoke') |
| 1664 | 2183 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2184 class Canvas(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2185 """Canvas widget to display graphical elements like lines or text.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2186 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2187 """Construct a canvas widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2188 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2189 Valid resource names: background, bd, bg, borderwidth, closeenough, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2190 confine, cursor, height, highlightbackground, highlightcolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2191 highlightthickness, insertbackground, insertborderwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2192 insertofftime, insertontime, insertwidth, offset, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2193 scrollregion, selectbackground, selectborderwidth, selectforeground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2194 state, takefocus, width, xscrollcommand, xscrollincrement, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2195 yscrollcommand, yscrollincrement.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2196 Widget.__init__(self, master, 'canvas', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2197 def addtag(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2198 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2199 self.tk.call((self._w, 'addtag') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2200 def addtag_above(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2201 """Add tag NEWTAG to all items above TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2202 self.addtag(newtag, 'above', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2203 def addtag_all(self, newtag): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2204 """Add tag NEWTAG to all items.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2205 self.addtag(newtag, 'all') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2206 def addtag_below(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2207 """Add tag NEWTAG to all items below TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2208 self.addtag(newtag, 'below', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2209 def addtag_closest(self, newtag, x, y, halo=None, start=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2210 """Add tag NEWTAG to item which is closest to pixel at X, Y. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2211 If several match take the top-most. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2212 All items closer than HALO are considered overlapping (all are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2213 closests). If START is specified the next below this tag is taken.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2214 self.addtag(newtag, 'closest', x, y, halo, start) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2215 def addtag_enclosed(self, newtag, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2216 """Add tag NEWTAG to all items in the rectangle defined |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2217 by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2218 self.addtag(newtag, 'enclosed', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2219 def addtag_overlapping(self, newtag, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2220 """Add tag NEWTAG to all items which overlap the rectangle |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2221 defined by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2222 self.addtag(newtag, 'overlapping', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2223 def addtag_withtag(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2224 """Add tag NEWTAG to all items with TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2225 self.addtag(newtag, 'withtag', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2226 def bbox(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2227 """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2228 which encloses all items with tags specified as arguments.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2229 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2230 self.tk.call((self._w, 'bbox') + args)) or None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2231 def tag_unbind(self, tagOrId, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2232 """Unbind for all items with TAGORID for event SEQUENCE the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2233 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2234 self.tk.call(self._w, 'bind', tagOrId, sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2235 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2236 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2237 def tag_bind(self, tagOrId, sequence=None, func=None, add=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2238 """Bind to all items with TAGORID at event SEQUENCE a call to function FUNC. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2239 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2240 An additional boolean parameter ADD specifies whether FUNC will be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2241 called additionally to the other bound function or whether it will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2242 replace the previous function. See bind for the return value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2243 return self._bind((self._w, 'bind', tagOrId), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2244 sequence, func, add) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2245 def canvasx(self, screenx, gridspacing=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2246 """Return the canvas x coordinate of pixel position SCREENX rounded |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2247 to nearest multiple of GRIDSPACING units.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2248 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2249 self._w, 'canvasx', screenx, gridspacing)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2250 def canvasy(self, screeny, gridspacing=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2251 """Return the canvas y coordinate of pixel position SCREENY rounded |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2252 to nearest multiple of GRIDSPACING units.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2253 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2254 self._w, 'canvasy', screeny, gridspacing)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2255 def coords(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2256 """Return a list of coordinates for the item given in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2257 # XXX Should use _flatten on args |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
2258 return [getdouble(x) for x in |
|
8390
76cd03979fca
Get rid of nearly all clals to self._do -- turns out self.tk.call can
Guido van Rossum <guido@python.org>
parents:
8211
diff
changeset
|
2259 self.tk.splitlist( |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
2260 self.tk.call((self._w, 'coords') + args))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2261 def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={}) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2262 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2263 args = _flatten(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2264 cnf = args[-1] |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
2265 if isinstance(cnf, (dict, tuple)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2266 args = args[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2267 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2268 cnf = {} |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2269 return getint(self.tk.call( |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2270 self._w, 'create', itemType, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2271 *(args + self._options(cnf, kw)))) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2272 def create_arc(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2273 """Create arc shaped region with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2274 return self._create('arc', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2275 def create_bitmap(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2276 """Create bitmap with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2277 return self._create('bitmap', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2278 def create_image(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2279 """Create image item with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2280 return self._create('image', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2281 def create_line(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2282 """Create line with coordinates x1,y1,...,xn,yn.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2283 return self._create('line', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2284 def create_oval(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2285 """Create oval with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2286 return self._create('oval', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2287 def create_polygon(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2288 """Create polygon with coordinates x1,y1,...,xn,yn.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2289 return self._create('polygon', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2290 def create_rectangle(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2291 """Create rectangle with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2292 return self._create('rectangle', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2293 def create_text(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2294 """Create text with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2295 return self._create('text', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2296 def create_window(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2297 """Create window with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2298 return self._create('window', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2299 def dchars(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2300 """Delete characters of text items identified by tag or id in ARGS (possibly |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2301 several times) from FIRST to LAST character (including).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2302 self.tk.call((self._w, 'dchars') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2303 def delete(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2304 """Delete items identified by all tag or ids contained in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2305 self.tk.call((self._w, 'delete') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2306 def dtag(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2307 """Delete tag or id given as last arguments in ARGS from items |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2308 identified by first argument in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2309 self.tk.call((self._w, 'dtag') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2310 def find(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2311 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2312 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2313 self.tk.call((self._w, 'find') + args)) or () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2314 def find_above(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2315 """Return items above TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2316 return self.find('above', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2317 def find_all(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2318 """Return all items.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2319 return self.find('all') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2320 def find_below(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2321 """Return all items below TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2322 return self.find('below', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2323 def find_closest(self, x, y, halo=None, start=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2324 """Return item which is closest to pixel at X, Y. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2325 If several match take the top-most. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2326 All items closer than HALO are considered overlapping (all are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2327 closests). If START is specified the next below this tag is taken.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2328 return self.find('closest', x, y, halo, start) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2329 def find_enclosed(self, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2330 """Return all items in rectangle defined |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2331 by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2332 return self.find('enclosed', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2333 def find_overlapping(self, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2334 """Return all items which overlap the rectangle |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2335 defined by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2336 return self.find('overlapping', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2337 def find_withtag(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2338 """Return all items with TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2339 return self.find('withtag', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2340 def focus(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2341 """Set focus to the first item specified in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2342 return self.tk.call((self._w, 'focus') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2343 def gettags(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2344 """Return tags associated with the first item specified in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2345 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2346 self.tk.call((self._w, 'gettags') + args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2347 def icursor(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2348 """Set cursor at position POS in the item identified by TAGORID. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2349 In ARGS TAGORID must be first.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2350 self.tk.call((self._w, 'icursor') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2351 def index(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2352 """Return position of cursor as integer in item specified in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2353 return getint(self.tk.call((self._w, 'index') + args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2354 def insert(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2355 """Insert TEXT in item TAGORID at position POS. ARGS must |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2356 be TAGORID POS TEXT.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2357 self.tk.call((self._w, 'insert') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2358 def itemcget(self, tagOrId, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2359 """Return the resource value for an OPTION for item TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2360 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2361 (self._w, 'itemcget') + (tagOrId, '-'+option)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2362 def itemconfigure(self, tagOrId, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2363 """Configure resources of an item TAGORID. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2364 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2365 The values for resources are specified as keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2366 arguments. To get an overview about |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2367 the allowed keyword arguments call the method without arguments. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2368 """ |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
2369 return self._configure(('itemconfigure', tagOrId), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2370 itemconfig = itemconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2371 # lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2372 # so the preferred name for them is tag_lower, tag_raise |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2373 # (similar to tag_bind, and similar to the Text widget); |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2374 # unfortunately can't delete the old ones yet (maybe in 1.6) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2375 def tag_lower(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2376 """Lower an item TAGORID given in ARGS |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2377 (optional below another item).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2378 self.tk.call((self._w, 'lower') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2379 lower = tag_lower |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2380 def move(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2381 """Move an item TAGORID given in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2382 self.tk.call((self._w, 'move') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2383 def postscript(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2384 """Print the contents of the canvas to a postscript |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2385 file. Valid options: colormap, colormode, file, fontmap, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2386 height, pageanchor, pageheight, pagewidth, pagex, pagey, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2387 rotate, witdh, x, y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2388 return self.tk.call((self._w, 'postscript') + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2389 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2390 def tag_raise(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2391 """Raise an item TAGORID given in ARGS |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2392 (optional above another item).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2393 self.tk.call((self._w, 'raise') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2394 lift = tkraise = tag_raise |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2395 def scale(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2396 """Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2397 self.tk.call((self._w, 'scale') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2398 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2399 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2400 self.tk.call(self._w, 'scan', 'mark', x, y) |
|
27211
a494f5a8639f
Fix SF bug # 602259, 3rd parameter for Tkinter.scan_dragto
Neal Norwitz <nnorwitz@gmail.com>
parents:
26428
diff
changeset
|
2401 def scan_dragto(self, x, y, gain=10): |
|
a494f5a8639f
Fix SF bug # 602259, 3rd parameter for Tkinter.scan_dragto
Neal Norwitz <nnorwitz@gmail.com>
parents:
26428
diff
changeset
|
2402 """Adjust the view of the canvas to GAIN times the |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2403 difference between X and Y and the coordinates given in |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2404 scan_mark.""" |
|
27211
a494f5a8639f
Fix SF bug # 602259, 3rd parameter for Tkinter.scan_dragto
Neal Norwitz <nnorwitz@gmail.com>
parents:
26428
diff
changeset
|
2405 self.tk.call(self._w, 'scan', 'dragto', x, y, gain) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2406 def select_adjust(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2407 """Adjust the end of the selection near the cursor of an item TAGORID to index.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2408 self.tk.call(self._w, 'select', 'adjust', tagOrId, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2409 def select_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2410 """Clear the selection if it is in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2411 self.tk.call(self._w, 'select', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2412 def select_from(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2413 """Set the fixed end of a selection in item TAGORID to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2414 self.tk.call(self._w, 'select', 'from', tagOrId, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2415 def select_item(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2416 """Return the item which has the selection.""" |
|
24357
17e94e62353c
SF patch #581396, Canvas "select_item" always returns None
Neal Norwitz <nnorwitz@gmail.com>
parents:
23241
diff
changeset
|
2417 return self.tk.call(self._w, 'select', 'item') or None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2418 def select_to(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2419 """Set the variable end of a selection in item TAGORID to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2420 self.tk.call(self._w, 'select', 'to', tagOrId, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2421 def type(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2422 """Return the type of the item TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2423 return self.tk.call(self._w, 'type', tagOrId) or None |
| 1664 | 2424 |
| 2425 class Checkbutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2426 """Checkbutton widget which is either in on- or off-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2427 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2428 """Construct a checkbutton widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2429 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2430 Valid resource names: activebackground, activeforeground, anchor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2431 background, bd, bg, bitmap, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2432 disabledforeground, fg, font, foreground, height, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2433 highlightbackground, highlightcolor, highlightthickness, image, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2434 indicatoron, justify, offvalue, onvalue, padx, pady, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2435 selectcolor, selectimage, state, takefocus, text, textvariable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2436 underline, variable, width, wraplength.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2437 Widget.__init__(self, master, 'checkbutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2438 def deselect(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2439 """Put the button in off-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2440 self.tk.call(self._w, 'deselect') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2441 def flash(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2442 """Flash the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2443 self.tk.call(self._w, 'flash') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2444 def invoke(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2445 """Toggle the button and invoke a command if given as resource.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2446 return self.tk.call(self._w, 'invoke') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2447 def select(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2448 """Put the button in on-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2449 self.tk.call(self._w, 'select') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2450 def toggle(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2451 """Toggle the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2452 self.tk.call(self._w, 'toggle') |
| 1664 | 2453 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2454 class Entry(Widget, XView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2455 """Entry widget which allows to display simple text.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2456 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2457 """Construct an entry widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2458 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2459 Valid resource names: background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2460 exportselection, fg, font, foreground, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2461 highlightcolor, highlightthickness, insertbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2462 insertborderwidth, insertofftime, insertontime, insertwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2463 invalidcommand, invcmd, justify, relief, selectbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2464 selectborderwidth, selectforeground, show, state, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2465 textvariable, validate, validatecommand, vcmd, width, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2466 xscrollcommand.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2467 Widget.__init__(self, master, 'entry', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2468 def delete(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2469 """Delete text from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2470 self.tk.call(self._w, 'delete', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2471 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2472 """Return the text.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2473 return self.tk.call(self._w, 'get') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2474 def icursor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2475 """Insert cursor at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2476 self.tk.call(self._w, 'icursor', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2477 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2478 """Return position of cursor.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2479 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2480 self._w, 'index', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2481 def insert(self, index, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2482 """Insert STRING at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2483 self.tk.call(self._w, 'insert', index, string) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2484 def scan_mark(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2485 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2486 self.tk.call(self._w, 'scan', 'mark', x) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2487 def scan_dragto(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2488 """Adjust the view of the canvas to 10 times the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2489 difference between X and Y and the coordinates given in |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2490 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2491 self.tk.call(self._w, 'scan', 'dragto', x) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2492 def selection_adjust(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2493 """Adjust the end of the selection near the cursor to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2494 self.tk.call(self._w, 'selection', 'adjust', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2495 select_adjust = selection_adjust |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2496 def selection_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2497 """Clear the selection if it is in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2498 self.tk.call(self._w, 'selection', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2499 select_clear = selection_clear |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2500 def selection_from(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2501 """Set the fixed end of a selection to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2502 self.tk.call(self._w, 'selection', 'from', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2503 select_from = selection_from |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2504 def selection_present(self): |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2505 """Return True if there are characters selected in the entry, False |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2506 otherwise.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2507 return self.tk.getboolean( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2508 self.tk.call(self._w, 'selection', 'present')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2509 select_present = selection_present |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2510 def selection_range(self, start, end): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2511 """Set the selection from START to END (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2512 self.tk.call(self._w, 'selection', 'range', start, end) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2513 select_range = selection_range |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2514 def selection_to(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2515 """Set the variable end of a selection to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2516 self.tk.call(self._w, 'selection', 'to', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2517 select_to = selection_to |
| 1664 | 2518 |
| 2519 class Frame(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2520 """Frame widget which may contain other widgets and can have a 3D border.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2521 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2522 """Construct a frame widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2523 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2524 Valid resource names: background, bd, bg, borderwidth, class, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2525 colormap, container, cursor, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2526 highlightcolor, highlightthickness, relief, takefocus, visual, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2527 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2528 extra = () |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2529 if 'class_' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2530 extra = ('-class', cnf['class_']) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2531 del cnf['class_'] |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2532 elif 'class' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2533 extra = ('-class', cnf['class']) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2534 del cnf['class'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2535 Widget.__init__(self, master, 'frame', cnf, {}, extra) |
| 1664 | 2536 |
| 2537 class Label(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2538 """Label widget which can display text and bitmaps.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2539 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2540 """Construct a label widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2541 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2542 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2543 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2544 activebackground, activeforeground, anchor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2545 background, bitmap, borderwidth, cursor, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2546 disabledforeground, font, foreground, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2547 highlightbackground, highlightcolor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2548 highlightthickness, image, justify, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2549 padx, pady, relief, takefocus, text, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2550 textvariable, underline, wraplength |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2551 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2552 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2553 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2554 height, state, width |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2555 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2556 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2557 Widget.__init__(self, master, 'label', cnf, kw) |
|
2830
bd79cd768ff8
Tk 4.0 and Tcl 7.4 are now standard
Guido van Rossum <guido@python.org>
parents:
2585
diff
changeset
|
2558 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2559 class Listbox(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2560 """Listbox widget which can display a list of strings.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2561 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2562 """Construct a listbox widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2563 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2564 Valid resource names: background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2565 exportselection, fg, font, foreground, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2566 highlightcolor, highlightthickness, relief, selectbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2567 selectborderwidth, selectforeground, selectmode, setgrid, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2568 width, xscrollcommand, yscrollcommand, listvariable.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2569 Widget.__init__(self, master, 'listbox', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2570 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2571 """Activate item identified by INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2572 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2573 def bbox(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2574 """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2575 which encloses the item identified by index in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2576 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2577 self.tk.call((self._w, 'bbox') + args)) or None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2578 def curselection(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2579 """Return list of indices of currently selected item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2580 # XXX Ought to apply self._getints()... |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2581 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2582 self._w, 'curselection')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2583 def delete(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2584 """Delete items from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2585 self.tk.call(self._w, 'delete', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2586 def get(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2587 """Get list of items from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2588 if last: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2589 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2590 self._w, 'get', first, last)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2591 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2592 return self.tk.call(self._w, 'get', first) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2593 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2594 """Return index of item identified with INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2595 i = self.tk.call(self._w, 'index', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2596 if i == 'none': return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2597 return getint(i) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2598 def insert(self, index, *elements): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2599 """Insert ELEMENTS at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2600 self.tk.call((self._w, 'insert', index) + elements) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2601 def nearest(self, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2602 """Get index of item which is nearest to y coordinate Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2603 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2604 self._w, 'nearest', y)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2605 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2606 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2607 self.tk.call(self._w, 'scan', 'mark', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2608 def scan_dragto(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2609 """Adjust the view of the listbox to 10 times the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2610 difference between X and Y and the coordinates given in |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2611 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2612 self.tk.call(self._w, 'scan', 'dragto', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2613 def see(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2614 """Scroll such that INDEX is visible.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2615 self.tk.call(self._w, 'see', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2616 def selection_anchor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2617 """Set the fixed end oft the selection to INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2618 self.tk.call(self._w, 'selection', 'anchor', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2619 select_anchor = selection_anchor |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2620 def selection_clear(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2621 """Clear the selection from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2622 self.tk.call(self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2623 'selection', 'clear', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2624 select_clear = selection_clear |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2625 def selection_includes(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2626 """Return 1 if INDEX is part of the selection.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2627 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2628 self._w, 'selection', 'includes', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2629 select_includes = selection_includes |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2630 def selection_set(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2631 """Set the selection from FIRST to LAST (not included) without |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2632 changing the currently selected elements.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2633 self.tk.call(self._w, 'selection', 'set', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2634 select_set = selection_set |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2635 def size(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2636 """Return the number of elements in the listbox.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2637 return getint(self.tk.call(self._w, 'size')) |
|
19743
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2638 def itemcget(self, index, option): |
|
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2639 """Return the resource value for an ITEM and an OPTION.""" |
|
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2640 return self.tk.call( |
|
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2641 (self._w, 'itemcget') + (index, '-'+option)) |
|
19638
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2642 def itemconfigure(self, index, cnf=None, **kw): |
|
19743
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2643 """Configure resources of an ITEM. |
|
19638
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2644 |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2645 The values for resources are specified as keyword arguments. |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2646 To get an overview about the allowed keyword arguments |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2647 call the method without arguments. |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2648 Valid resource names: background, bg, foreground, fg, |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2649 selectbackground, selectforeground.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
2650 return self._configure(('itemconfigure', index), cnf, kw) |
|
19638
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2651 itemconfig = itemconfigure |
| 1664 | 2652 |
| 2653 class Menu(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2654 """Menu widget which allows to display menu bars, pull-down menus and pop-up menus.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2655 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2656 """Construct menu widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2657 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2658 Valid resource names: activebackground, activeborderwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2659 activeforeground, background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2660 disabledforeground, fg, font, foreground, postcommand, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2661 selectcolor, takefocus, tearoff, tearoffcommand, title, type.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2662 Widget.__init__(self, master, 'menu', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2663 def tk_bindForTraversal(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2664 pass # obsolete since Tk 4.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2665 def tk_mbPost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2666 self.tk.call('tk_mbPost', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2667 def tk_mbUnpost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2668 self.tk.call('tk_mbUnpost') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2669 def tk_traverseToMenu(self, char): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2670 self.tk.call('tk_traverseToMenu', self._w, char) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2671 def tk_traverseWithinMenu(self, char): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2672 self.tk.call('tk_traverseWithinMenu', self._w, char) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2673 def tk_getMenuButtons(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2674 return self.tk.call('tk_getMenuButtons', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2675 def tk_nextMenu(self, count): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2676 self.tk.call('tk_nextMenu', count) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2677 def tk_nextMenuEntry(self, count): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2678 self.tk.call('tk_nextMenuEntry', count) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2679 def tk_invokeMenu(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2680 self.tk.call('tk_invokeMenu', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2681 def tk_firstMenu(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2682 self.tk.call('tk_firstMenu', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2683 def tk_mbButtonDown(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2684 self.tk.call('tk_mbButtonDown', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2685 def tk_popup(self, x, y, entry=""): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2686 """Post the menu at position X,Y with entry ENTRY.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2687 self.tk.call('tk_popup', self._w, x, y, entry) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2688 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2689 """Activate entry at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2690 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2691 def add(self, itemType, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2692 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2693 self.tk.call((self._w, 'add', itemType) + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2694 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2695 def add_cascade(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2696 """Add hierarchical menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2697 self.add('cascade', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2698 def add_checkbutton(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2699 """Add checkbutton menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2700 self.add('checkbutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2701 def add_command(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2702 """Add command menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2703 self.add('command', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2704 def add_radiobutton(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2705 """Addd radio menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2706 self.add('radiobutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2707 def add_separator(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2708 """Add separator.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2709 self.add('separator', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2710 def insert(self, index, itemType, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2711 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2712 self.tk.call((self._w, 'insert', index, itemType) + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2713 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2714 def insert_cascade(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2715 """Add hierarchical menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2716 self.insert(index, 'cascade', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2717 def insert_checkbutton(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2718 """Add checkbutton menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2719 self.insert(index, 'checkbutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2720 def insert_command(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2721 """Add command menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2722 self.insert(index, 'command', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2723 def insert_radiobutton(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2724 """Addd radio menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2725 self.insert(index, 'radiobutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2726 def insert_separator(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2727 """Add separator at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2728 self.insert(index, 'separator', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2729 def delete(self, index1, index2=None): |
|
49639
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2730 """Delete menu items between INDEX1 and INDEX2 (included).""" |
|
48676
054dc111b1d9
Merged revisions 65622 via svnmerge from
Robert Schuppenies <okkotonushi@googlemail.com>
parents:
48619
diff
changeset
|
2731 if index2 is None: |
|
054dc111b1d9
Merged revisions 65622 via svnmerge from
Robert Schuppenies <okkotonushi@googlemail.com>
parents:
48619
diff
changeset
|
2732 index2 = index1 |
|
49639
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2733 |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2734 num_index1, num_index2 = self.index(index1), self.index(index2) |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2735 if (num_index1 is None) or (num_index2 is None): |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2736 num_index1, num_index2 = 0, -1 |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2737 |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2738 for i in range(num_index1, num_index2 + 1): |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2739 if 'command' in self.entryconfig(i): |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2740 c = str(self.entrycget(i, 'command')) |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2741 if c: |
|
f67b2c8fa93a
Issue #3774: Fixed an error when create a Tkinter menu item without command
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
parents:
49013
diff
changeset
|
2742 self.deletecommand(c) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2743 self.tk.call(self._w, 'delete', index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2744 def entrycget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2745 """Return the resource value of an menu item for OPTION at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2746 return self.tk.call(self._w, 'entrycget', index, '-' + option) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2747 def entryconfigure(self, index, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2748 """Configure a menu item at INDEX.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
2749 return self._configure(('entryconfigure', index), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2750 entryconfig = entryconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2751 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2752 """Return the index of a menu item identified by INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2753 i = self.tk.call(self._w, 'index', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2754 if i == 'none': return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2755 return getint(i) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2756 def invoke(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2757 """Invoke a menu item identified by INDEX and execute |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2758 the associated command.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2759 return self.tk.call(self._w, 'invoke', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2760 def post(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2761 """Display a menu at position X,Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2762 self.tk.call(self._w, 'post', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2763 def type(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2764 """Return the type of the menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2765 return self.tk.call(self._w, 'type', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2766 def unpost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2767 """Unmap a menu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2768 self.tk.call(self._w, 'unpost') |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2769 def xposition(self, index): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2770 """Return the x-position of the leftmost pixel of the menu item |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2771 at INDEX.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2772 return getint(self.tk.call(self._w, 'xposition', index)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2773 def yposition(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2774 """Return the y-position of the topmost pixel of the menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2775 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2776 self._w, 'yposition', index)) |
| 1664 | 2777 |
| 2778 class Menubutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2779 """Menubutton widget, obsolete since Tk8.0.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2780 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2781 Widget.__init__(self, master, 'menubutton', cnf, kw) |
| 1664 | 2782 |
| 2783 class Message(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2784 """Message widget to display multiline text. Obsolete since Label does it too.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2785 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2786 Widget.__init__(self, master, 'message', cnf, kw) |
| 1664 | 2787 |
| 2788 class Radiobutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2789 """Radiobutton widget which shows only one of several buttons in on-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2790 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2791 """Construct a radiobutton widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2792 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2793 Valid resource names: activebackground, activeforeground, anchor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2794 background, bd, bg, bitmap, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2795 disabledforeground, fg, font, foreground, height, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2796 highlightbackground, highlightcolor, highlightthickness, image, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2797 indicatoron, justify, padx, pady, relief, selectcolor, selectimage, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2798 state, takefocus, text, textvariable, underline, value, variable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2799 width, wraplength.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2800 Widget.__init__(self, master, 'radiobutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2801 def deselect(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2802 """Put the button in off-state.""" |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2803 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2804 self.tk.call(self._w, 'deselect') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2805 def flash(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2806 """Flash the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2807 self.tk.call(self._w, 'flash') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2808 def invoke(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2809 """Toggle the button and invoke a command if given as resource.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2810 return self.tk.call(self._w, 'invoke') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2811 def select(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2812 """Put the button in on-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2813 self.tk.call(self._w, 'select') |
| 1664 | 2814 |
| 2815 class Scale(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2816 """Scale widget which can display a numerical scale.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2817 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2818 """Construct a scale widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2819 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2820 Valid resource names: activebackground, background, bigincrement, bd, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2821 bg, borderwidth, command, cursor, digits, fg, font, foreground, from, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2822 highlightbackground, highlightcolor, highlightthickness, label, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2823 length, orient, relief, repeatdelay, repeatinterval, resolution, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2824 showvalue, sliderlength, sliderrelief, state, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2825 tickinterval, to, troughcolor, variable, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2826 Widget.__init__(self, master, 'scale', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2827 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2828 """Get the current value as integer or float.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2829 value = self.tk.call(self._w, 'get') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2830 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2831 return getint(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2832 except ValueError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2833 return getdouble(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2834 def set(self, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2835 """Set the value to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2836 self.tk.call(self._w, 'set', value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2837 def coords(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2838 """Return a tuple (X,Y) of the point along the centerline of the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2839 trough that corresponds to VALUE or the current value if None is |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2840 given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2841 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2842 return self._getints(self.tk.call(self._w, 'coords', value)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2843 def identify(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2844 """Return where the point X,Y lies. Valid return values are "slider", |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2845 "though1" and "though2".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2846 return self.tk.call(self._w, 'identify', x, y) |
| 1664 | 2847 |
| 2848 class Scrollbar(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2849 """Scrollbar widget which displays a slider at a certain position.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2850 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2851 """Construct a scrollbar widget with the parent MASTER. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2852 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2853 Valid resource names: activebackground, activerelief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2854 background, bd, bg, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2855 elementborderwidth, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2856 highlightcolor, highlightthickness, jump, orient, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2857 relief, repeatdelay, repeatinterval, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2858 troughcolor, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2859 Widget.__init__(self, master, 'scrollbar', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2860 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2861 """Display the element at INDEX with activebackground and activerelief. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2862 INDEX can be "arrow1","slider" or "arrow2".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2863 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2864 def delta(self, deltax, deltay): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2865 """Return the fractional change of the scrollbar setting if it |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2866 would be moved by DELTAX or DELTAY pixels.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2867 return getdouble( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2868 self.tk.call(self._w, 'delta', deltax, deltay)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2869 def fraction(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2870 """Return the fractional value which corresponds to a slider |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2871 position of X,Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2872 return getdouble(self.tk.call(self._w, 'fraction', x, y)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2873 def identify(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2874 """Return the element under position X,Y as one of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2875 "arrow1","slider","arrow2" or "".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2876 return self.tk.call(self._w, 'identify', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2877 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2878 """Return the current fractional values (upper and lower end) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2879 of the slider position.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2880 return self._getdoubles(self.tk.call(self._w, 'get')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2881 def set(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2882 """Set the fractional values of the slider position (upper and |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2883 lower ends as value between 0 and 1).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2884 self.tk.call((self._w, 'set') + args) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2885 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2886 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2887 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2888 class Text(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2889 """Text widget which can display text in various forms.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2890 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2891 """Construct a text widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2892 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2893 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2894 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2895 background, borderwidth, cursor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2896 exportselection, font, foreground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2897 highlightbackground, highlightcolor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2898 highlightthickness, insertbackground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2899 insertborderwidth, insertofftime, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2900 insertontime, insertwidth, padx, pady, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2901 relief, selectbackground, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2902 selectborderwidth, selectforeground, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2903 setgrid, takefocus, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2904 xscrollcommand, yscrollcommand, |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2905 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2906 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2907 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2908 autoseparators, height, maxundo, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2909 spacing1, spacing2, spacing3, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2910 state, tabs, undo, width, wrap, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2911 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2912 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2913 Widget.__init__(self, master, 'text', cnf, kw) |
|
86877
c40b573c9f7a
Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises
Serhiy Storchaka <storchaka@gmail.com>
diff
changeset
|
2914 def bbox(self, index): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2915 """Return a tuple of (x,y,width,height) which gives the bounding |
|
86877
c40b573c9f7a
Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises
Serhiy Storchaka <storchaka@gmail.com>
diff
changeset
|
2916 box of the visible part of the character at the given index.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2917 return self._getints( |
|
86877
c40b573c9f7a
Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises
Serhiy Storchaka <storchaka@gmail.com>
diff
changeset
|
2918 self.tk.call(self._w, 'bbox', index)) or None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2919 def tk_textSelectTo(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2920 self.tk.call('tk_textSelectTo', self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2921 def tk_textBackspace(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2922 self.tk.call('tk_textBackspace', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2923 def tk_textIndexCloser(self, a, b, c): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2924 self.tk.call('tk_textIndexCloser', self._w, a, b, c) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2925 def tk_textResetAnchor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2926 self.tk.call('tk_textResetAnchor', self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2927 def compare(self, index1, op, index2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2928 """Return whether between index INDEX1 and index INDEX2 the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2929 relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2930 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2931 self._w, 'compare', index1, op, index2)) |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2932 def count(self, index1, index2, *args): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2933 """Counts the number of relevant things between the two indices. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2934 If index1 is after index2, the result will be a negative number |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2935 (and this holds for each of the possible options). |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2936 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2937 The actual items which are counted depends on the options given by |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2938 args. The result is a list of integers, one for the result of each |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2939 counting option given. Valid counting options are "chars", |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2940 "displaychars", "displayindices", "displaylines", "indices", |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2941 "lines", "xpixels" and "ypixels". There is an additional possible |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2942 option "update", which if given then all subsequent options ensure |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2943 that any possible out of date information is recalculated.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2944 args = ['-%s' % arg for arg in args if not arg.startswith('-')] |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2945 args += [index1, index2] |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2946 res = self.tk.call(self._w, 'count', *args) or None |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2947 if res is not None and len(args) <= 3: |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2948 return (res, ) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2949 else: |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
2950 return res |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2951 def debug(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2952 """Turn on the internal consistency checks of the B-Tree inside the text |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2953 widget according to BOOLEAN.""" |
|
86876
3f5e35b766ac
Issue #6157: Fixed tkinter.Text.debug(). Original patch by Guilherme Polo.
Serhiy Storchaka <storchaka@gmail.com>
parents:
86873
diff
changeset
|
2954 if boolean is None: |
|
3f5e35b766ac
Issue #6157: Fixed tkinter.Text.debug(). Original patch by Guilherme Polo.
Serhiy Storchaka <storchaka@gmail.com>
parents:
86873
diff
changeset
|
2955 return self.tk.call(self._w, 'debug') |
|
3f5e35b766ac
Issue #6157: Fixed tkinter.Text.debug(). Original patch by Guilherme Polo.
Serhiy Storchaka <storchaka@gmail.com>
parents:
86873
diff
changeset
|
2956 self.tk.call(self._w, 'debug', boolean) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2957 def delete(self, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2958 """Delete the characters between INDEX1 and INDEX2 (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2959 self.tk.call(self._w, 'delete', index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2960 def dlineinfo(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2961 """Return tuple (x,y,width,height,baseline) giving the bounding box |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2962 and baseline position of the visible part of the line containing |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2963 the character at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2964 return self._getints(self.tk.call(self._w, 'dlineinfo', index)) |
|
23241
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2965 def dump(self, index1, index2=None, command=None, **kw): |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2966 """Return the contents of the widget between index1 and index2. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2967 |
|
23241
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2968 The type of contents returned in filtered based on the keyword |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2969 parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2970 given and true, then the corresponding items are returned. The result |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2971 is a list of triples of the form (key, value, index). If none of the |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2972 keywords are true then 'all' is used by default. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2973 |
|
23241
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2974 If the 'command' argument is given, it is called once for each element |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2975 of the list of triples, with the values of each triple serving as the |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2976 arguments to the function. In this case the list is not returned.""" |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2977 args = [] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2978 func_name = None |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2979 result = None |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2980 if not command: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2981 # Never call the dump command without the -command flag, since the |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2982 # output could involve Tcl quoting and would be a pain to parse |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2983 # right. Instead just set the command to build a list of triples |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2984 # as if we had done the parsing. |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2985 result = [] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2986 def append_triple(key, value, index, result=result): |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2987 result.append((key, value, index)) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2988 command = append_triple |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2989 try: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2990 if not isinstance(command, str): |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2991 func_name = command = self._register(command) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2992 args += ["-command", command] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2993 for key in kw: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2994 if kw[key]: args.append("-" + key) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2995 args.append(index1) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2996 if index2: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2997 args.append(index2) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2998 self.tk.call(self._w, "dump", *args) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2999 return result |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
3000 finally: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
3001 if func_name: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
3002 self.deletecommand(func_name) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3003 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3004 ## new in tk8.4 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3005 def edit(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3006 """Internal method |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3007 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3008 This method controls the undo mechanism and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3009 the modified flag. The exact behavior of the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3010 command depends on the option argument that |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3011 follows the edit argument. The following forms |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3012 of the command are currently supported: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3013 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3014 edit_modified, edit_redo, edit_reset, edit_separator |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3015 and edit_undo |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3016 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3017 """ |
|
47278
f762a9ab69dd
Merged revisions 63412,63445-63447,63449-63450,63452,63454,63459,63463,63465,63470,63483-63484,63496-63497,63499-63501,63530-63531,63540,63614 via svnmerge from
Georg Brandl <georg@python.org>
parents:
47130
diff
changeset
|
3018 return self.tk.call(self._w, 'edit', *args) |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3019 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3020 def edit_modified(self, arg=None): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3021 """Get or Set the modified flag |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3022 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3023 If arg is not specified, returns the modified |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3024 flag of the widget. The insert, delete, edit undo and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3025 edit redo commands or the user can set or clear the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3026 modified flag. If boolean is specified, sets the |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3027 modified flag of the widget to arg. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3028 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3029 return self.edit("modified", arg) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3030 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3031 def edit_redo(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3032 """Redo the last undone edit |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3033 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3034 When the undo option is true, reapplies the last |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3035 undone edits provided no other edits were done since |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3036 then. Generates an error when the redo stack is empty. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3037 Does nothing when the undo option is false. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3038 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3039 return self.edit("redo") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3040 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3041 def edit_reset(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3042 """Clears the undo and redo stacks |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3043 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3044 return self.edit("reset") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3045 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3046 def edit_separator(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3047 """Inserts a separator (boundary) on the undo stack. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3048 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3049 Does nothing when the undo option is false |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3050 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3051 return self.edit("separator") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3052 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3053 def edit_undo(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3054 """Undoes the last edit action |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3055 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3056 If the undo option is true. An edit action is defined |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3057 as all the insert and delete commands that are recorded |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3058 on the undo stack in between two separators. Generates |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3059 an error when the undo stack is empty. Does nothing |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3060 when the undo option is false |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3061 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3062 return self.edit("undo") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3063 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3064 def get(self, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3065 """Return the text from INDEX1 to INDEX2 (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3066 return self.tk.call(self._w, 'get', index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3067 # (Image commands are new in 8.0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3068 def image_cget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3069 """Return the value of OPTION of an embedded image at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3070 if option[:1] != "-": |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3071 option = "-" + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3072 if option[-1:] == "_": |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3073 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3074 return self.tk.call(self._w, "image", "cget", index, option) |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3075 def image_configure(self, index, cnf=None, **kw): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3076 """Configure an embedded image at INDEX.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3077 return self._configure(('image', 'configure', index), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3078 def image_create(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3079 """Create an embedded image at INDEX.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3080 return self.tk.call( |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3081 self._w, "image", "create", index, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3082 *self._options(cnf, kw)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3083 def image_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3084 """Return all names of embedded images in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3085 return self.tk.call(self._w, "image", "names") |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3086 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3087 """Return the index in the form line.char for INDEX.""" |
|
44428
6e93d2d6eb28
Merged revisions 59642-59665 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44026
diff
changeset
|
3088 return str(self.tk.call(self._w, 'index', index)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3089 def insert(self, index, chars, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3090 """Insert CHARS before the characters at INDEX. An additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3091 tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3092 self.tk.call((self._w, 'insert', index, chars) + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3093 def mark_gravity(self, markName, direction=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3094 """Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3095 Return the current value if None is given for DIRECTION.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3096 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3097 (self._w, 'mark', 'gravity', markName, direction)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3098 def mark_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3099 """Return all mark names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3100 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3101 self._w, 'mark', 'names')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3102 def mark_set(self, markName, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3103 """Set mark MARKNAME before the character at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3104 self.tk.call(self._w, 'mark', 'set', markName, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3105 def mark_unset(self, *markNames): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3106 """Delete all marks in MARKNAMES.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3107 self.tk.call((self._w, 'mark', 'unset') + markNames) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3108 def mark_next(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3109 """Return the name of the next mark after INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3110 return self.tk.call(self._w, 'mark', 'next', index) or None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3111 def mark_previous(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3112 """Return the name of the previous mark before INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3113 return self.tk.call(self._w, 'mark', 'previous', index) or None |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3114 def peer_create(self, newPathName, cnf={}, **kw): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3115 """Creates a peer text widget with the given newPathName, and any |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3116 optional standard configuration options. By default the peer will |
|
82621
e9ada209b67f
Issue #17047: remove doubled words added in 3.3
Terry Jan Reedy <tjreedy@udel.edu>
parents:
81528
diff
changeset
|
3117 have the same start and end line as the parent widget, but |
|
75598
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3118 these can be overriden with the standard configuration options.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3119 self.tk.call(self._w, 'peer', 'create', newPathName, |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3120 *self._options(cnf, kw)) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3121 def peer_names(self): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3122 """Returns a list of peers of this widget (this does not include |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3123 the widget itself).""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3124 return self.tk.splitlist(self.tk.call(self._w, 'peer', 'names')) |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3125 def replace(self, index1, index2, chars, *args): # new in Tk 8.5 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3126 """Replaces the range of characters between index1 and index2 with |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3127 the given characters and tags specified by args. |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3128 |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3129 See the method insert for some more information about args, and the |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3130 method delete for information about the indices.""" |
|
71041c0dedd5
Issue #2843: Add new Tk API to Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
75569
diff
changeset
|
3131 self.tk.call(self._w, 'replace', index1, index2, chars, *args) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3132 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3133 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3134 self.tk.call(self._w, 'scan', 'mark', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3135 def scan_dragto(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3136 """Adjust the view of the text to 10 times the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3137 difference between X and Y and the coordinates given in |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3138 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3139 self.tk.call(self._w, 'scan', 'dragto', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3140 def search(self, pattern, index, stopindex=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3141 forwards=None, backwards=None, exact=None, |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39782
diff
changeset
|
3142 regexp=None, nocase=None, count=None, elide=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3143 """Search PATTERN beginning from INDEX until STOPINDEX. |
|
51484
663ce74d5175
Merged revisions 69463 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
50532
diff
changeset
|
3144 Return the index of the first character of a match or an |
|
663ce74d5175
Merged revisions 69463 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
50532
diff
changeset
|
3145 empty string.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3146 args = [self._w, 'search'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3147 if forwards: args.append('-forwards') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3148 if backwards: args.append('-backwards') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3149 if exact: args.append('-exact') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3150 if regexp: args.append('-regexp') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3151 if nocase: args.append('-nocase') |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39782
diff
changeset
|
3152 if elide: args.append('-elide') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3153 if count: args.append('-count'); args.append(count) |
|
51484
663ce74d5175
Merged revisions 69463 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
50532
diff
changeset
|
3154 if pattern and pattern[0] == '-': args.append('--') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3155 args.append(pattern) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3156 args.append(index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3157 if stopindex: args.append(stopindex) |
|
52057
03c80e0742c3
Merged revisions 70218-70219 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
51776
diff
changeset
|
3158 return str(self.tk.call(tuple(args))) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3159 def see(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3160 """Scroll such that the character at INDEX is visible.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3161 self.tk.call(self._w, 'see', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3162 def tag_add(self, tagName, index1, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3163 """Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3164 Additional pairs of indices may follow in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3165 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3166 (self._w, 'tag', 'add', tagName, index1) + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3167 def tag_unbind(self, tagName, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3168 """Unbind for all characters with TAGNAME for event SEQUENCE the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3169 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3170 self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3171 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3172 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3173 def tag_bind(self, tagName, sequence, func, add=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3174 """Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
3175 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3176 An additional boolean parameter ADD specifies whether FUNC will be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3177 called additionally to the other bound function or whether it will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3178 replace the previous function. See bind for the return value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3179 return self._bind((self._w, 'tag', 'bind', tagName), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3180 sequence, func, add) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3181 def tag_cget(self, tagName, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3182 """Return the value of OPTION for tag TAGNAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3183 if option[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3184 option = '-' + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3185 if option[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3186 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3187 return self.tk.call(self._w, 'tag', 'cget', tagName, option) |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3188 def tag_configure(self, tagName, cnf=None, **kw): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3189 """Configure a tag TAGNAME.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3190 return self._configure(('tag', 'configure', tagName), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3191 tag_config = tag_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3192 def tag_delete(self, *tagNames): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3193 """Delete all tags in TAGNAMES.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3194 self.tk.call((self._w, 'tag', 'delete') + tagNames) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3195 def tag_lower(self, tagName, belowThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3196 """Change the priority of tag TAGNAME such that it is lower |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3197 than the priority of BELOWTHIS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3198 self.tk.call(self._w, 'tag', 'lower', tagName, belowThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3199 def tag_names(self, index=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3200 """Return a list of all tag names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3201 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3202 self.tk.call(self._w, 'tag', 'names', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3203 def tag_nextrange(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3204 """Return a list of start and end index for the first sequence of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3205 characters between INDEX1 and INDEX2 which all have tag TAGNAME. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3206 The text is searched forward from INDEX1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3207 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3208 self._w, 'tag', 'nextrange', tagName, index1, index2)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3209 def tag_prevrange(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3210 """Return a list of start and end index for the first sequence of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3211 characters between INDEX1 and INDEX2 which all have tag TAGNAME. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3212 The text is searched backwards from INDEX1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3213 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3214 self._w, 'tag', 'prevrange', tagName, index1, index2)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3215 def tag_raise(self, tagName, aboveThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3216 """Change the priority of tag TAGNAME such that it is higher |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3217 than the priority of ABOVETHIS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3218 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3219 self._w, 'tag', 'raise', tagName, aboveThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3220 def tag_ranges(self, tagName): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3221 """Return a list of ranges of text which have tag TAGNAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3222 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3223 self._w, 'tag', 'ranges', tagName)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3224 def tag_remove(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3225 """Remove tag TAGNAME from all characters between INDEX1 and INDEX2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3226 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3227 self._w, 'tag', 'remove', tagName, index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3228 def window_cget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3229 """Return the value of OPTION of an embedded window at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3230 if option[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3231 option = '-' + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3232 if option[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3233 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3234 return self.tk.call(self._w, 'window', 'cget', index, option) |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3235 def window_configure(self, index, cnf=None, **kw): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3236 """Configure an embedded window at INDEX.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3237 return self._configure(('window', 'configure', index), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3238 window_config = window_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3239 def window_create(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3240 """Create a window at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3241 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3242 (self._w, 'window', 'create', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3243 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3244 def window_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3245 """Return all names of embedded windows in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3246 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3247 self.tk.call(self._w, 'window', 'names')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3248 def yview_pickplace(self, *what): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3249 """Obsolete function, use see.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3250 self.tk.call((self._w, 'yview', '-pickplace') + what) |
| 1664 | 3251 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3252 |
|
4428
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3253 class _setit: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3254 """Internal class. It wraps the command in the widget OptionMenu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3255 def __init__(self, var, value, callback=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3256 self.__value = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3257 self.__var = var |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3258 self.__callback = callback |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3259 def __call__(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3260 self.__var.set(self.__value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3261 if self.__callback: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3262 self.__callback(self.__value, *args) |
|
4428
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3263 |
|
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3264 class OptionMenu(Menubutton): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3265 """OptionMenu which allows the user to select a value from a menu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3266 def __init__(self, master, variable, value, *values, **kwargs): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3267 """Construct an optionmenu widget with the parent MASTER, with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3268 the resource textvariable set to VARIABLE, the initially selected |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3269 value VALUE, the other menu values VALUES and an additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3270 keyword argument command.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3271 kw = {"borderwidth": 2, "textvariable": variable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3272 "indicatoron": 1, "relief": RAISED, "anchor": "c", |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3273 "highlightthickness": 2} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3274 Widget.__init__(self, master, "menubutton", kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3275 self.widgetName = 'tk_optionMenu' |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3276 menu = self.__menu = Menu(self, name="menu", tearoff=0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3277 self.menuname = menu._w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3278 # 'command' is the only supported keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3279 callback = kwargs.get('command') |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
3280 if 'command' in kwargs: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3281 del kwargs['command'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3282 if kwargs: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
3283 raise TclError('unknown option -'+kwargs.keys()[0]) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3284 menu.add_command(label=value, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3285 command=_setit(variable, value, callback)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3286 for v in values: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3287 menu.add_command(label=v, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3288 command=_setit(variable, v, callback)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3289 self["menu"] = menu |
|
4428
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3290 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3291 def __getitem__(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3292 if name == 'menu': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3293 return self.__menu |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3294 return Widget.__getitem__(self, name) |
|
4428
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3295 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3296 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3297 """Destroy this widget and the associated menu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3298 Menubutton.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3299 self.__menu = None |
|
3067
6ec820db2ffa
added OptionMenu class (tk_optionMenu interface)
Guido van Rossum <guido@python.org>
parents:
2968
diff
changeset
|
3300 |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3301 class Image: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3302 """Base class for images.""" |
|
14470
39ff6b3c43af
Fix for bug 110629: Generate unique image names by introducing a counter
Martin v. Löwis <martin@v.loewis.de>
parents:
14453
diff
changeset
|
3303 _last_id = 0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3304 def __init__(self, imgtype, name=None, cnf={}, master=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3305 self.name = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3306 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3307 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3308 if not master: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
3309 raise RuntimeError('Too early to create image') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3310 self.tk = master.tk |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3311 if not name: |
|
14470
39ff6b3c43af
Fix for bug 110629: Generate unique image names by introducing a counter
Martin v. Löwis <martin@v.loewis.de>
parents:
14453
diff
changeset
|
3312 Image._last_id += 1 |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
3313 name = "pyimage%r" % (Image._last_id,) # tk itself would use image<x> |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3314 # The following is needed for systems where id(x) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3315 # can return a negative number, such as Linux/m68k: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3316 if name[0] == '-': name = '_' + name[1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3317 if kw and cnf: cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3318 elif kw: cnf = kw |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3319 options = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3320 for k, v in cnf.items(): |
|
73165
8e57b5d8f58f
Closes #13258: Use callable() built-in in the standard library.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
68489
diff
changeset
|
3321 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3322 v = self._register(v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3323 options = options + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3324 self.tk.call(('image', 'create', imgtype, name,) + options) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3325 self.name = name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3326 def __str__(self): return self.name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3327 def __del__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3328 if self.name: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3329 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3330 self.tk.call('image', 'delete', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3331 except TclError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3332 # May happen if the root was destroyed |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3333 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3334 def __setitem__(self, key, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3335 self.tk.call(self.name, 'configure', '-'+key, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3336 def __getitem__(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3337 return self.tk.call(self.name, 'configure', '-'+key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3338 def configure(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3339 """Configure the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3340 res = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3341 for k, v in _cnfmerge(kw).items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3342 if v is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3343 if k[-1] == '_': k = k[:-1] |
|
73165
8e57b5d8f58f
Closes #13258: Use callable() built-in in the standard library.
Florent Xicluna <florent.xicluna@gmail.com>
parents:
68489
diff
changeset
|
3344 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3345 v = self._register(v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3346 res = res + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3347 self.tk.call((self.name, 'config') + res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3348 config = configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3349 def height(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3350 """Return the height of the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3351 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3352 self.tk.call('image', 'height', self.name)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3353 def type(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3354 """Return the type of the imgage, e.g. "photo" or "bitmap".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3355 return self.tk.call('image', 'type', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3356 def width(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3357 """Return the width of the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3358 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3359 self.tk.call('image', 'width', self.name)) |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3360 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3361 class PhotoImage(Image): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3362 """Widget which can display colored images in GIF, PPM/PGM format.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3363 def __init__(self, name=None, cnf={}, master=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3364 """Create an image with NAME. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
3365 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3366 Valid resource names: data, format, file, gamma, height, palette, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3367 width.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3368 Image.__init__(self, 'photo', name, cnf, master, **kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3369 def blank(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3370 """Display a transparent image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3371 self.tk.call(self.name, 'blank') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3372 def cget(self, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3373 """Return the value of OPTION.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3374 return self.tk.call(self.name, 'cget', '-' + option) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3375 # XXX config |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3376 def __getitem__(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3377 return self.tk.call(self.name, 'cget', '-' + key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3378 # XXX copy -from, -to, ...? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3379 def copy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3380 """Return a new PhotoImage with the same image as this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3381 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3382 self.tk.call(destImage, 'copy', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3383 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3384 def zoom(self,x,y=''): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3385 """Return a new PhotoImage with the same image as this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3386 but zoom it with X and Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3387 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3388 if y=='': y=x |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3389 self.tk.call(destImage, 'copy', self.name, '-zoom',x,y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3390 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3391 def subsample(self,x,y=''): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3392 """Return a new PhotoImage based on the same image as this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3393 but use only every Xth or Yth pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3394 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3395 if y=='': y=x |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3396 self.tk.call(destImage, 'copy', self.name, '-subsample',x,y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3397 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3398 def get(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3399 """Return the color (red, green, blue) of the pixel at X,Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3400 return self.tk.call(self.name, 'get', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3401 def put(self, data, to=None): |
|
51776
d06a3ebf306f
Merged revisions 69846 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents:
51484
diff
changeset
|
3402 """Put row formatted colors to image starting from |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3403 position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3404 args = (self.name, 'put', data) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3405 if to: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3406 if to[0] == '-to': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3407 to = to[1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3408 args = args + ('-to',) + tuple(to) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3409 self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3410 # XXX read |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3411 def write(self, filename, format=None, from_coords=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3412 """Write image to file FILENAME in FORMAT starting from |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3413 position FROM_COORDS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3414 args = (self.name, 'write', filename) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3415 if format: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3416 args = args + ('-format', format) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3417 if from_coords: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3418 args = args + ('-from',) + tuple(from_coords) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3419 self.tk.call(args) |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3420 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3421 class BitmapImage(Image): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3422 """Widget which can display a bitmap.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3423 def __init__(self, name=None, cnf={}, master=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3424 """Create a bitmap with NAME. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
3425 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3426 Valid resource names: background, data, file, foreground, maskdata, maskfile.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3427 Image.__init__(self, 'bitmap', name, cnf, master, **kw) |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3428 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3429 def image_names(): return _default_root.tk.call('image', 'names') |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3430 def image_types(): return _default_root.tk.call('image', 'types') |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3431 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3432 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
3433 class Spinbox(Widget, XView): |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3434 """spinbox widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3435 def __init__(self, master=None, cnf={}, **kw): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3436 """Construct a spinbox widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3437 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3438 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3439 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3440 activebackground, background, borderwidth, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3441 cursor, exportselection, font, foreground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3442 highlightbackground, highlightcolor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3443 highlightthickness, insertbackground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3444 insertborderwidth, insertofftime, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3445 insertontime, insertwidth, justify, relief, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3446 repeatdelay, repeatinterval, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3447 selectbackground, selectborderwidth |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3448 selectforeground, takefocus, textvariable |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3449 xscrollcommand. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3450 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3451 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3452 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3453 buttonbackground, buttoncursor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3454 buttondownrelief, buttonuprelief, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3455 command, disabledbackground, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3456 disabledforeground, format, from, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3457 invalidcommand, increment, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3458 readonlybackground, state, to, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3459 validate, validatecommand values, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3460 width, wrap, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3461 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3462 Widget.__init__(self, master, 'spinbox', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3463 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3464 def bbox(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3465 """Return a tuple of X1,Y1,X2,Y2 coordinates for a |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3466 rectangle which encloses the character given by index. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3467 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3468 The first two elements of the list give the x and y |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3469 coordinates of the upper-left corner of the screen |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3470 area covered by the character (in pixels relative |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3471 to the widget) and the last two elements give the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3472 width and height of the character, in pixels. The |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3473 bounding box may refer to a region outside the |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3474 visible area of the window. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3475 """ |
|
86873
5bdbf2258563
Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
Serhiy Storchaka <storchaka@gmail.com>
parents:
85720
diff
changeset
|
3476 return self._getints(self.tk.call(self._w, 'bbox', index)) or None |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3477 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3478 def delete(self, first, last=None): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3479 """Delete one or more elements of the spinbox. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3480 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3481 First is the index of the first character to delete, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3482 and last is the index of the character just after |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3483 the last one to delete. If last isn't specified it |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3484 defaults to first+1, i.e. a single character is |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3485 deleted. This command returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3486 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3487 return self.tk.call(self._w, 'delete', first, last) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3488 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3489 def get(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3490 """Returns the spinbox's string""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3491 return self.tk.call(self._w, 'get') |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3492 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3493 def icursor(self, index): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3494 """Alter the position of the insertion cursor. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3495 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3496 The insertion cursor will be displayed just before |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3497 the character given by index. Returns an empty string |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3498 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3499 return self.tk.call(self._w, 'icursor', index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3500 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3501 def identify(self, x, y): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3502 """Returns the name of the widget at position x, y |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3503 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3504 Return value is one of: none, buttondown, buttonup, entry |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3505 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3506 return self.tk.call(self._w, 'identify', x, y) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3507 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3508 def index(self, index): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3509 """Returns the numerical index corresponding to index |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3510 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3511 return self.tk.call(self._w, 'index', index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3512 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3513 def insert(self, index, s): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3514 """Insert string s at index |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3515 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3516 Returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3517 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3518 return self.tk.call(self._w, 'insert', index, s) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3519 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3520 def invoke(self, element): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3521 """Causes the specified element to be invoked |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3522 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3523 The element could be buttondown or buttonup |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3524 triggering the action associated with it. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3525 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3526 return self.tk.call(self._w, 'invoke', element) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3527 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3528 def scan(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3529 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3530 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3531 self.tk.call((self._w, 'scan') + args)) or () |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3532 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3533 def scan_mark(self, x): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3534 """Records x and the current view in the spinbox window; |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3535 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3536 used in conjunction with later scan dragto commands. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3537 Typically this command is associated with a mouse button |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3538 press in the widget. It returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3539 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3540 return self.scan("mark", x) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3541 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3542 def scan_dragto(self, x): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3543 """Compute the difference between the given x argument |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3544 and the x argument to the last scan mark command |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3545 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3546 It then adjusts the view left or right by 10 times the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3547 difference in x-coordinates. This command is typically |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3548 associated with mouse motion events in the widget, to |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3549 produce the effect of dragging the spinbox at high speed |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3550 through the window. The return value is an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3551 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3552 return self.scan("dragto", x) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3553 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3554 def selection(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3555 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3556 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3557 self.tk.call((self._w, 'selection') + args)) or () |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3558 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3559 def selection_adjust(self, index): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3560 """Locate the end of the selection nearest to the character |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3561 given by index, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3562 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3563 Then adjust that end of the selection to be at index |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3564 (i.e including but not going beyond index). The other |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3565 end of the selection is made the anchor point for future |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3566 select to commands. If the selection isn't currently in |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3567 the spinbox, then a new selection is created to include |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3568 the characters between index and the most recent selection |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3569 anchor point, inclusive. Returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3570 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3571 return self.selection("adjust", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3572 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3573 def selection_clear(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3574 """Clear the selection |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3575 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3576 If the selection isn't in this widget then the |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3577 command has no effect. Returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3578 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3579 return self.selection("clear") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3580 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3581 def selection_element(self, element=None): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3582 """Sets or gets the currently selected element. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3583 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3584 If a spinbutton element is specified, it will be |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3585 displayed depressed |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3586 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3587 return self.selection("element", element) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3588 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3589 ########################################################################### |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3590 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3591 class LabelFrame(Widget): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3592 """labelframe widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3593 def __init__(self, master=None, cnf={}, **kw): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3594 """Construct a labelframe widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3595 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3596 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3597 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3598 borderwidth, cursor, font, foreground, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3599 highlightbackground, highlightcolor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3600 highlightthickness, padx, pady, relief, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3601 takefocus, text |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3602 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3603 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3604 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3605 background, class, colormap, container, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3606 height, labelanchor, labelwidget, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3607 visual, width |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3608 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3609 Widget.__init__(self, master, 'labelframe', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3610 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3611 ######################################################################## |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3612 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3613 class PanedWindow(Widget): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3614 """panedwindow widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3615 def __init__(self, master=None, cnf={}, **kw): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3616 """Construct a panedwindow widget with the parent MASTER. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3617 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3618 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3619 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3620 background, borderwidth, cursor, height, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3621 orient, relief, width |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3622 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3623 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3624 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3625 handlepad, handlesize, opaqueresize, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3626 sashcursor, sashpad, sashrelief, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3627 sashwidth, showhandle, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3628 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3629 Widget.__init__(self, master, 'panedwindow', cnf, kw) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3630 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3631 def add(self, child, **kw): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3632 """Add a child widget to the panedwindow in a new pane. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3633 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3634 The child argument is the name of the child widget |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3635 followed by pairs of arguments that specify how to |
|
54475
7b772ed536c7
Merged revisions 73083 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
52057
diff
changeset
|
3636 manage the windows. The possible options and values |
|
7b772ed536c7
Merged revisions 73083 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
52057
diff
changeset
|
3637 are the ones accepted by the paneconfigure method. |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3638 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3639 self.tk.call((self._w, 'add', child) + self._options(kw)) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3640 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3641 def remove(self, child): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3642 """Remove the pane containing child from the panedwindow |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3643 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3644 All geometry management options for child will be forgotten. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3645 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3646 self.tk.call(self._w, 'forget', child) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3647 forget=remove |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3648 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3649 def identify(self, x, y): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3650 """Identify the panedwindow component at point x, y |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3651 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3652 If the point is over a sash or a sash handle, the result |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3653 is a two element list containing the index of the sash or |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3654 handle, and a word indicating whether it is over a sash |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3655 or a handle, such as {0 sash} or {2 handle}. If the point |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3656 is over any other part of the panedwindow, the result is |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3657 an empty list. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3658 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3659 return self.tk.call(self._w, 'identify', x, y) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3660 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3661 def proxy(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3662 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3663 return self._getints( |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3664 self.tk.call((self._w, 'proxy') + args)) or () |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3665 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3666 def proxy_coord(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3667 """Return the x and y pair of the most recent proxy location |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3668 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3669 return self.proxy("coord") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3670 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3671 def proxy_forget(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3672 """Remove the proxy from the display. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3673 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3674 return self.proxy("forget") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3675 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3676 def proxy_place(self, x, y): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3677 """Place the proxy at the given x and y coordinates. |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3678 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3679 return self.proxy("place", x, y) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3680 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3681 def sash(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3682 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3683 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3684 self.tk.call((self._w, 'sash') + args)) or () |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3685 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3686 def sash_coord(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3687 """Return the current x and y pair for the sash given by index. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3688 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3689 Index must be an integer between 0 and 1 less than the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3690 number of panes in the panedwindow. The coordinates given are |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3691 those of the top left corner of the region containing the sash. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3692 pathName sash dragto index x y This command computes the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3693 difference between the given coordinates and the coordinates |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3694 given to the last sash coord command for the given sash. It then |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3695 moves that sash the computed difference. The return value is the |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3696 empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3697 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3698 return self.sash("coord", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3699 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3700 def sash_mark(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3701 """Records x and y for the sash given by index; |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3702 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3703 Used in conjunction with later dragto commands to move the sash. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3704 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3705 return self.sash("mark", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3706 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3707 def sash_place(self, index, x, y): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3708 """Place the sash given by index at the given coordinates |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3709 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3710 return self.sash("place", index, x, y) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3711 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3712 def panecget(self, child, option): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3713 """Query a management option for window. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3714 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3715 Option may be any value allowed by the paneconfigure subcommand |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3716 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3717 return self.tk.call( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3718 (self._w, 'panecget') + (child, '-'+option)) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3719 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3720 def paneconfigure(self, tagOrId, cnf=None, **kw): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3721 """Query or modify the management options for window. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3722 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3723 If no option is specified, returns a list describing all |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3724 of the available options for pathName. If option is |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3725 specified with no value, then the command returns a list |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3726 describing the one named option (this list will be identical |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3727 to the corresponding sublist of the value returned if no |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3728 option is specified). If one or more option-value pairs are |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3729 specified, then the command modifies the given widget |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3730 option(s) to have the given value(s); in this case the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3731 command returns an empty string. The following options |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3732 are supported: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3733 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3734 after window |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3735 Insert the window after the window specified. window |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3736 should be the name of a window already managed by pathName. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3737 before window |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3738 Insert the window before the window specified. window |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3739 should be the name of a window already managed by pathName. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3740 height size |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3741 Specify a height for the window. The height will be the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3742 outer dimension of the window including its border, if |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3743 any. If size is an empty string, or if -height is not |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3744 specified, then the height requested internally by the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3745 window will be used initially; the height may later be |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3746 adjusted by the movement of sashes in the panedwindow. |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3747 Size may be any value accepted by Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3748 minsize n |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3749 Specifies that the size of the window cannot be made |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3750 less than n. This constraint only affects the size of |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3751 the widget in the paned dimension -- the x dimension |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3752 for horizontal panedwindows, the y dimension for |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3753 vertical panedwindows. May be any value accepted by |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3754 Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3755 padx n |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3756 Specifies a non-negative value indicating how much |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3757 extra space to leave on each side of the window in |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3758 the X-direction. The value may have any of the forms |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3759 accepted by Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3760 pady n |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3761 Specifies a non-negative value indicating how much |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3762 extra space to leave on each side of the window in |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3763 the Y-direction. The value may have any of the forms |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3764 accepted by Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3765 sticky style |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3766 If a window's pane is larger than the requested |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3767 dimensions of the window, this option may be used |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3768 to position (or stretch) the window within its pane. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3769 Style is a string that contains zero or more of the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3770 characters n, s, e or w. The string can optionally |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3771 contains spaces or commas, but they are ignored. Each |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3772 letter refers to a side (north, south, east, or west) |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3773 that the window will "stick" to. If both n and s |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3774 (or e and w) are specified, the window will be |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3775 stretched to fill the entire height (or width) of |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3776 its cavity. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3777 width size |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3778 Specify a width for the window. The width will be |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3779 the outer dimension of the window including its |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3780 border, if any. If size is an empty string, or |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3781 if -width is not specified, then the width requested |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3782 internally by the window will be used initially; the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3783 width may later be adjusted by the movement of sashes |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3784 in the panedwindow. Size may be any value accepted by |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3785 Tk_GetPixels. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3786 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3787 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3788 if cnf is None and not kw: |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3789 cnf = {} |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3790 for x in self.tk.split( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3791 self.tk.call(self._w, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3792 'paneconfigure', tagOrId)): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3793 cnf[x[0][1:]] = (x[0][1:],) + x[1:] |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3794 return cnf |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
3795 if isinstance(cnf, str) and not kw: |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3796 x = self.tk.split(self.tk.call( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3797 self._w, 'paneconfigure', tagOrId, '-'+cnf)) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3798 return (x[0][1:],) + x[1:] |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3799 self.tk.call((self._w, 'paneconfigure', tagOrId) + |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3800 self._options(cnf, kw)) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3801 paneconfig = paneconfigure |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3802 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3803 def panes(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3804 """Returns an ordered list of the child panes.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3805 return self.tk.call(self._w, 'panes') |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3806 |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3807 ###################################################################### |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3808 # Extensions: |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3809 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3810 class Studbutton(Button): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3811 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3812 Widget.__init__(self, master, 'studbutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3813 self.bind('<Any-Enter>', self.tkButtonEnter) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3814 self.bind('<Any-Leave>', self.tkButtonLeave) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3815 self.bind('<1>', self.tkButtonDown) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3816 self.bind('<ButtonRelease-1>', self.tkButtonUp) |
|
1688
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3817 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3818 class Tributton(Button): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3819 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3820 Widget.__init__(self, master, 'tributton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3821 self.bind('<Any-Enter>', self.tkButtonEnter) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3822 self.bind('<Any-Leave>', self.tkButtonLeave) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3823 self.bind('<1>', self.tkButtonDown) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3824 self.bind('<ButtonRelease-1>', self.tkButtonUp) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3825 self['fg'] = self['bg'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3826 self['activebackground'] = self['bg'] |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
3827 |
|
4103
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3828 ###################################################################### |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3829 # Test: |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3830 |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3831 def _test(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3832 root = Tk() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3833 text = "This is Tcl/Tk version %s" % TclVersion |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3834 if TclVersion >= 8.1: |
|
42050
ca693f4fd05d
Simplify various spots where: str() is called on something
Walter Dörwald <walter@livinglogic.de>
parents:
41986
diff
changeset
|
3835 text += "\nThis should be a cedilla: \xe7" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3836 label = Label(root, text=text) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3837 label.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3838 test = Button(root, text="Click me!", |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3839 command=lambda root=root: root.test.configure( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3840 text="[%s]" % root.test['text'])) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3841 test.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3842 root.test = test |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3843 quit = Button(root, text="QUIT", command=root.destroy) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3844 quit.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3845 # The following three commands are needed so the window pops |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3846 # up on top on Windows... |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3847 root.iconify() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3848 root.update() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3849 root.deiconify() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3850 root.mainloop() |
|
4103
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3851 |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3852 if __name__ == '__main__': |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3853 _test() |
