Mercurial > cpython-lru_cache-weakref
annotate Lib/tkinter/__init__.py @ 78069:a8aa77458e12 3.2
Add c_size_t and c_ssize_t to the ctypes summary table.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jul 2012 20:31:50 +0200 |
| parents | 41382250e5e1 |
| children | b742bbf6b07f 97601cbf169f |
| 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 |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
33 __version__ = "$Revision$" |
|
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
34 |
|
9763
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
35 import sys |
|
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
36 if sys.platform == "win32": |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
37 # Attempt to configure Tcl/Tk without requiring PATH |
|
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
38 from tkinter import _fix |
|
9763
16c9a714880f
This hopefully fixes the problem of having to set PATH
Guido van Rossum <guido@python.org>
parents:
9666
diff
changeset
|
39 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
|
40 TclError = _tkinter.TclError |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
41 from tkinter.constants import * |
|
2830
bd79cd768ff8
Tk 4.0 and Tcl 7.4 are now standard
Guido van Rossum <guido@python.org>
parents:
2585
diff
changeset
|
42 |
|
26428
0103f0b75fe2
Rename want_objects to wantobjects throughout, for consistency.
Martin v. Löwis <martin@v.loewis.de>
parents:
26416
diff
changeset
|
43 wantobjects = 1 |
|
26416
bd09e3a2d536
Patch #518625: Return objects in Tkinter.
Martin v. Löwis <martin@v.loewis.de>
parents:
25754
diff
changeset
|
44 |
|
16517
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
45 TkVersion = float(_tkinter.TK_VERSION) |
|
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
46 TclVersion = float(_tkinter.TCL_VERSION) |
| 1664 | 47 |
|
5944
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
48 READABLE = _tkinter.READABLE |
|
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
49 WRITABLE = _tkinter.WRITABLE |
|
1bd68e4464ce
Get READABLE c.s. from _tkinter instead of conditional definition.
Guido van Rossum <guido@python.org>
parents:
5868
diff
changeset
|
50 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
|
51 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
52 |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
53 def _flatten(seq): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
54 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
55 res = () |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
56 for item in seq: |
|
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
57 if isinstance(item, (tuple, list)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
58 res = res + _flatten(item) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
59 elif item is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
60 res = res + (item,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
61 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
|
62 |
| 12953 | 63 try: _flatten = _tkinter._flatten |
| 64 except AttributeError: pass | |
| 65 | |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
66 def _cnfmerge(cnfs): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
67 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
68 if isinstance(cnfs, dict): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
69 return cnfs |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
70 elif isinstance(cnfs, (type(None), str)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
71 return cnfs |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
72 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
73 cnf = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
74 for c in _flatten(cnfs): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
75 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
76 cnf.update(c) |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
77 except (AttributeError, TypeError) as msg: |
|
40775
4cdf21a0dbbc
Fix most trivially-findable print statements.
Guido van Rossum <guido@python.org>
parents:
40587
diff
changeset
|
78 print("_cnfmerge: fallback due to:", msg) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
79 for k, v in c.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
80 cnf[k] = v |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
81 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
|
82 |
| 12953 | 83 try: _cnfmerge = _tkinter._cnfmerge |
| 84 except AttributeError: pass | |
| 85 | |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
86 class Event: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
87 """Container for the properties of an event. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
88 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
89 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
|
90 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
91 KeyPress, KeyRelease - for keyboard events |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
92 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
|
93 Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
94 Colormap, Gravity, Reparent, Property, Destroy, Activate, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
95 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
|
96 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 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
|
101 the attribute is valid): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
102 |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
103 serial - serial number of event |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
104 num - mouse button pressed (ButtonPress, ButtonRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
105 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
|
106 height - height of the exposed window (Configure, Expose) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
107 width - width of the exposed window (Configure, Expose) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
108 keycode - keycode of the pressed key (KeyPress, KeyRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
109 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
|
110 Enter, KeyPress, KeyRelease, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
111 Leave, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
112 state - state as a string (Visibility) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
113 time - when the event occurred |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
114 x - x-position of the mouse |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
115 y - y-position of the mouse |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
116 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
|
117 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
118 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
|
119 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
120 char - pressed character (KeyPress, KeyRelease) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
121 send_event - see X/Windows documentation |
| 35850 | 122 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
|
123 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
|
124 type - type of the event as a number |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
125 widget - widget in which the event occurred |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
126 delta - delta of wheel movement (MouseWheel) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
127 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
128 pass |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
129 |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
130 _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
|
131 _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
|
132 |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
133 def NoDefaultRoot(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
134 """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
|
135 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
136 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
|
137 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
|
138 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
139 global _support_default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
140 _support_default_root = 0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
141 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
142 _default_root = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
143 del _default_root |
|
7731
9c37ed8868b9
Give in to the tab police.
Guido van Rossum <guido@python.org>
parents:
7463
diff
changeset
|
144 |
|
1671
953e74eac006
Added dictionary mapping names to children, and _name attribute.
Guido van Rossum <guido@python.org>
parents:
1669
diff
changeset
|
145 def _tkerror(err): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
146 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
147 pass |
| 1664 | 148 |
|
1714
db0eaef42cb9
Added _exit and register as Tcl command exit. Micro lay-out fix.
Guido van Rossum <guido@python.org>
parents:
1709
diff
changeset
|
149 def _exit(code='0'): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
150 """Internal function. Calling it will throw the exception SystemExit.""" |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
151 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
|
152 |
|
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
|
153 _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
|
154 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
|
155 """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
|
156 |
|
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
157 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
|
158 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
|
159 _default = "" |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
160 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
|
161 """Construct a variable |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
162 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
163 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
164 VALUE is an optional value (defaults to "") |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
165 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
|
166 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
167 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
|
168 then the existing value is retained. |
|
13903
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 _varnum |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
171 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
172 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
173 self._master = master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
174 self._tk = master.tk |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
175 if name: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
176 self._name = name |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
177 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
178 self._name = 'PY_VAR' + repr(_varnum) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
179 _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
|
180 if value is not None: |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
181 self.set(value) |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
182 elif not self._tk.call("info", "exists", self._name): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
183 self.set(self._default) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
184 def __del__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
185 """Unset the variable in Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
186 self._tk.globalunsetvar(self._name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
187 def __str__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
188 """Return the name of the variable in Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
189 return self._name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
190 def set(self, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
191 """Set the variable to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
192 return self._tk.globalsetvar(self._name, value) |
|
28642
cfece1822e94
Add 'get' method to Variable and switch it from internal class to
Guido van Rossum <guido@python.org>
parents:
28639
diff
changeset
|
193 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
|
194 """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
|
195 return self._tk.globalgetvar(self._name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
196 def trace_variable(self, mode, callback): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
197 """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
|
198 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
203 Return the name of the callback. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
204 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
205 cbname = self._master._register(callback) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
206 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
|
207 return cbname |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
208 trace = trace_variable |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
209 def trace_vdelete(self, mode, cbname): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
210 """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
|
211 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
212 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
|
213 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
|
214 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
215 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
|
216 self._master.deletecommand(cbname) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
217 def trace_vinfo(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
218 """Return all trace callback information.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
219 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
|
220 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
|
221 def __eq__(self, other): |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
222 """Comparison for equality (==). |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
223 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
224 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
|
225 also compare self._master == other._master |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
226 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
227 return self.__class__.__name__ == other.__class__.__name__ \ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
228 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
|
229 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
230 class StringVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
231 """Value holder for strings variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
232 _default = "" |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
233 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
|
234 """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
|
235 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
236 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
237 VALUE is an optional value (defaults to "") |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
238 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
|
239 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
240 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
|
241 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
242 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
243 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
|
244 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
245 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
246 """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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
252 class IntVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
253 """Value holder for integer variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
254 _default = 0 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
255 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
|
256 """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
|
257 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
258 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
259 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
|
260 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
|
261 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
262 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
|
263 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
264 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
265 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
|
266 |
|
27341
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
267 def set(self, value): |
|
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
268 """Set the variable to value, converting booleans to integers.""" |
|
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
269 if isinstance(value, bool): |
|
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
270 value = int(value) |
|
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
271 return Variable.set(self, value) |
|
ba63d717c75f
Convert booleans to integers in IntVar.set. Fixes #671741.
Martin v. Löwis <martin@v.loewis.de>
parents:
27211
diff
changeset
|
272 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
273 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
274 """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
|
275 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
|
276 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
277 class DoubleVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
278 """Value holder for float variables.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
279 _default = 0.0 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
280 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
|
281 """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
|
282 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
283 MASTER can be given as master widget. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
284 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
|
285 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
|
286 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
287 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
|
288 then the existing value is retained. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
289 """ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
290 Variable.__init__(self, master, value, name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
291 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
292 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
293 """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
|
294 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
|
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 BooleanVar(Variable): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
297 """Value holder for boolean variables.""" |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
298 _default = False |
|
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 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
|
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 False) |
|
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): |
|
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
|
312 """Return the value of the variable as a bool.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
313 return self._tk.getboolean(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 |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
315 def mainloop(n=0): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
316 """Run the main loop of Tcl.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
317 _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
|
318 |
|
8209
34cca832a4af
Another optimization, probably of negligeable effect: instead of
Guido van Rossum <guido@python.org>
parents:
8207
diff
changeset
|
319 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
|
320 |
|
8209
34cca832a4af
Another optimization, probably of negligeable effect: instead of
Guido van Rossum <guido@python.org>
parents:
8207
diff
changeset
|
321 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
|
322 |
|
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
323 def getboolean(s): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
324 """Convert true and false to integer values 1 and 0.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
325 return _default_root.tk.getboolean(s) |
|
1703
ba957aa42241
Tue Jul 5 13:22:45 1994 (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1700
diff
changeset
|
326 |
| 6571 | 327 # Methods defined on both toplevel and interior widgets |
| 1664 | 328 class Misc: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
329 """Internal class. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
330 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
331 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
|
332 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
333 # XXX font command? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
334 _tclCommands = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
335 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
336 """Internal function. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
337 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
338 Delete all Tcl commands created for |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
339 this widget in the Tcl interpreter.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
340 if self._tclCommands is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
341 for name in self._tclCommands: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
342 #print '- Tkinter: deleted command', name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
343 self.tk.deletecommand(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
344 self._tclCommands = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
345 def deletecommand(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
346 """Internal function. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
347 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
348 Delete the Tcl command provided in NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
349 #print '- Tkinter: deleted command', name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
350 self.tk.deletecommand(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
351 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
352 self._tclCommands.remove(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
353 except ValueError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
354 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
355 def tk_strictMotif(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
356 """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
|
357 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
|
358 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
359 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
|
360 change if mouse passes over slider). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
361 Returns the set value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
362 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
363 'set', 'tk_strictMotif', boolean)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
364 def tk_bisque(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
365 """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
|
366 self.tk.call('tk_bisque') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
367 def tk_setPalette(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
368 """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
|
369 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
370 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
|
371 widget elements are derived from this. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
372 Alternatively several keyword parameters and its associated |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
373 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
|
374 activeBackground, foreground, selectColor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
375 activeForeground, highlightBackground, selectBackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
376 background, highlightColor, selectForeground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
377 disabledForeground, insertBackground, troughColor.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
378 self.tk.call(('tk_setPalette',) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
379 + _flatten(args) + _flatten(kw.items())) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
380 def tk_menuBar(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
381 """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
|
382 pass # obsolete since Tk 4.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
383 def wait_variable(self, name='PY_VAR'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
384 """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
|
385 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
386 A parameter of type IntVar, StringVar, DoubleVar or |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
387 BooleanVar must be given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
388 self.tk.call('tkwait', 'variable', name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
389 waitvar = wait_variable # XXX b/w compat |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
390 def wait_window(self, window=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
391 """Wait until a WIDGET is destroyed. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
392 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
393 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
|
394 if window is None: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
395 window = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
396 self.tk.call('tkwait', 'window', window._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
397 def wait_visibility(self, window=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
398 """Wait until the visibility of a WIDGET changes |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
399 (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
|
400 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
401 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
|
402 if window is None: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
403 window = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
404 self.tk.call('tkwait', 'visibility', window._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
405 def setvar(self, name='PY_VAR', value='1'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
406 """Set Tcl variable NAME to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
407 self.tk.setvar(name, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
408 def getvar(self, name='PY_VAR'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
409 """Return value of Tcl variable NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
410 return self.tk.getvar(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
411 getint = int |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
412 getdouble = float |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
413 def getboolean(self, s): |
|
28645
b9745cd791bf
Remove extra space in docstring
Neal Norwitz <nnorwitz@gmail.com>
parents:
28642
diff
changeset
|
414 """Return a boolean value for Tcl boolean values true and false given as parameter.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
415 return self.tk.getboolean(s) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
416 def focus_set(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
417 """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
|
418 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
419 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
|
420 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
|
421 the focus through the window manager.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
422 self.tk.call('focus', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
423 focus = focus_set # XXX b/w compat? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
424 def focus_force(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
425 """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
|
426 application does not have the focus. Use with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
427 caution!""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
428 self.tk.call('focus', '-force', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
429 def focus_get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
430 """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
|
431 application. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
432 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
433 Use focus_displayof to allow working with several |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
434 displays. Return None if application does not have |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
435 the focus.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
436 name = self.tk.call('focus') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
437 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
438 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
439 def focus_displayof(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
440 """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
|
441 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
|
442 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
443 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
|
444 name = self.tk.call('focus', '-displayof', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
445 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
446 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
447 def focus_lastfor(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
448 """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
|
449 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
|
450 name = self.tk.call('focus', '-lastfor', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
451 if name == 'none' or not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
452 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
453 def tk_focusFollowsMouse(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
454 """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
|
455 be disabled easily.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
456 self.tk.call('tk_focusFollowsMouse') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
457 def tk_focusNext(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
458 """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
|
459 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
|
460 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
461 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
|
462 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
|
463 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
|
464 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
|
465 to 0.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
466 name = self.tk.call('tk_focusNext', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
467 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
468 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
469 def tk_focusPrev(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
470 """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
|
471 name = self.tk.call('tk_focusPrev', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
472 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
473 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
474 def after(self, ms, func=None, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
475 """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
|
476 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
477 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
|
478 function which shall be called. Additional parameters |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
479 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
|
480 identifier to cancel scheduling with after_cancel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
481 if not func: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
482 # 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
|
483 self.tk.call('after', ms) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
484 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
|
485 def callit(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
486 try: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
487 func(*args) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
488 finally: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
489 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
|
490 self.deletecommand(name) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
491 except TclError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
492 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
493 name = self._register(callit) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
494 return self.tk.call('after', ms, name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
495 def after_idle(self, func, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
496 """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
|
497 process. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
498 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
499 Return an identifier to cancel the scheduling with |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
500 after_cancel.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
501 return self.after('idle', func, *args) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
502 def after_cancel(self, id): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
503 """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
|
504 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
505 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
|
506 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
|
507 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
|
508 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
|
509 # 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
|
510 # 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
|
511 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
|
512 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
|
513 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
|
514 pass |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
515 self.tk.call('after', 'cancel', id) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
516 def bell(self, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
517 """Ring a display's bell.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
518 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
|
519 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
520 # 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
|
521 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
|
522 """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
|
523 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
524 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
|
525 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
|
526 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
527 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
|
528 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
|
529 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
|
530 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
|
531 |
|
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 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
|
533 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
37042
diff
changeset
|
534 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
|
535 """ |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
536 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
|
537 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
538 kw['type'] = 'UTF8_STRING' |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
539 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
|
540 except TclError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
541 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
|
542 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
|
543 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
544 def clipboard_clear(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
545 """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
|
546 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
547 A widget specified for the optional displayof keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
548 argument specifies the target display.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
549 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
|
550 self.tk.call(('clipboard', 'clear') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
551 def clipboard_append(self, string, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
552 """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
|
553 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
554 A widget specified at the optional displayof keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
555 argument specifies the target display. The clipboard |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
556 can be retrieved with selection_get.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
557 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
|
558 self.tk.call(('clipboard', 'append') + self._options(kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
559 + ('--', string)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
560 # XXX grab current w/o window argument |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
561 def grab_current(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
562 """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
|
563 or None.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
564 name = self.tk.call('grab', 'current', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
565 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
566 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
567 def grab_release(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
568 """Release grab for this widget if currently set.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
569 self.tk.call('grab', 'release', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
570 def grab_set(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
571 """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
|
572 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
573 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
|
574 widgets in the application.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
575 self.tk.call('grab', 'set', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
576 def grab_set_global(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
577 """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
|
578 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
579 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
|
580 descendant widgets on the display. Use with caution - |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
581 other applications do not get events anymore.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
582 self.tk.call('grab', 'set', '-global', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
583 def grab_status(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
584 """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
|
585 no, a local or a global grab.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
586 status = self.tk.call('grab', 'status', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
587 if status == 'none': status = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
588 return status |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
589 def option_add(self, pattern, value, priority = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
590 """Set a VALUE (second parameter) for an option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
591 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
|
592 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
593 An optional third parameter gives the numeric priority |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
594 (defaults to 80).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
595 self.tk.call('option', 'add', pattern, value, priority) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
596 def option_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
597 """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
|
598 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
599 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
|
600 self.tk.call('option', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
601 def option_get(self, name, className): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
602 """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
|
603 with CLASSNAME. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
604 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
605 Values with higher priority override lower values.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
606 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
|
607 def option_readfile(self, fileName, priority = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
608 """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
|
609 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
610 An optional second parameter gives the numeric |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
611 priority.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
612 self.tk.call('option', 'readfile', fileName, priority) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
613 def selection_clear(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
614 """Clear the current X selection.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
615 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
|
616 self.tk.call(('selection', 'clear') + self._options(kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
617 def selection_get(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
618 """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
|
619 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
620 A keyword parameter selection specifies the name of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
621 the selection and defaults to PRIMARY. A keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
622 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
|
623 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
|
624 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
|
625 before STRING.""" |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
626 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
|
627 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
|
628 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
629 kw['type'] = 'UTF8_STRING' |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
630 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
|
631 except TclError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
632 del kw['type'] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
633 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
|
634 def selection_handle(self, command, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
635 """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
|
636 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
|
637 application. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
638 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
639 This function must return the contents of the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
640 selection. The function will be called with the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
641 arguments OFFSET and LENGTH which allows the chunking |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
642 of very long selections. The following keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
643 parameters can be provided: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
644 selection - name of the selection (default PRIMARY), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
645 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
|
646 name = self._register(command) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
647 self.tk.call(('selection', 'handle') + self._options(kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
648 + (self._w, name)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
649 def selection_own(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
650 """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
|
651 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
652 A keyword parameter selection specifies the name of |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
653 the selection (default PRIMARY).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
654 self.tk.call(('selection', 'own') + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
655 self._options(kw) + (self._w,)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
656 def selection_own_get(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
657 """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
|
658 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
659 The following keyword parameter can |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
660 be provided: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
661 selection - name of the selection (default PRIMARY), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
662 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
|
663 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
|
664 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
|
665 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
666 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
667 def send(self, interp, cmd, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
668 """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
|
669 return self.tk.call(('send', interp, cmd) + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
670 def lower(self, belowThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
671 """Lower this widget in the stacking order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
672 self.tk.call('lower', self._w, belowThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
673 def tkraise(self, aboveThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
674 """Raise this widget in the stacking order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
675 self.tk.call('raise', self._w, aboveThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
676 lift = tkraise |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
677 def colormodel(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
678 """Useless. Not implemented in Tk.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
679 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
|
680 def winfo_atom(self, name, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
681 """Return integer which represents atom NAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
682 args = ('winfo', 'atom') + self._displayof(displayof) + (name,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
683 return getint(self.tk.call(args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
684 def winfo_atomname(self, id, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
685 """Return name of atom with identifier ID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
686 args = ('winfo', 'atomname') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
687 + self._displayof(displayof) + (id,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
688 return self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
689 def winfo_cells(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
690 """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
|
691 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
692 self.tk.call('winfo', 'cells', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
693 def winfo_children(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
694 """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
|
695 result = [] |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
696 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
|
697 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
|
698 try: |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
699 # 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
|
700 # 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
|
701 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
|
702 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
|
703 pass |
|
83776ba580ef
Ignore widgets with unknown names in winfo_children. Fixes #518283.
Martin v. Löwis <martin@v.loewis.de>
parents:
20414
diff
changeset
|
704 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
|
705 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
706 def winfo_class(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
707 """Return window class name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
708 return self.tk.call('winfo', 'class', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
709 def winfo_colormapfull(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
710 """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
|
711 return self.tk.getboolean( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
712 self.tk.call('winfo', 'colormapfull', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
713 def winfo_containing(self, rootX, rootY, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
714 """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
|
715 args = ('winfo', 'containing') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
716 + self._displayof(displayof) + (rootX, rootY) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
717 name = self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
718 if not name: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
719 return self._nametowidget(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
720 def winfo_depth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
721 """Return the number of bits per pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
722 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
|
723 def winfo_exists(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
724 """Return true if this widget exists.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
725 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
726 self.tk.call('winfo', 'exists', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
727 def winfo_fpixels(self, number): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
728 """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
|
729 (e.g. "3c") as float.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
730 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
731 'winfo', 'fpixels', self._w, number)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
732 def winfo_geometry(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
733 """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
|
734 return self.tk.call('winfo', 'geometry', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
735 def winfo_height(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
736 """Return height of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
737 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
738 self.tk.call('winfo', 'height', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
739 def winfo_id(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
740 """Return identifier ID for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
741 return self.tk.getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
742 self.tk.call('winfo', 'id', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
743 def winfo_interps(self, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
744 """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
|
745 args = ('winfo', 'interps') + self._displayof(displayof) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
746 return self.tk.splitlist(self.tk.call(args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
747 def winfo_ismapped(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
748 """Return true if this widget is mapped.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
749 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
750 self.tk.call('winfo', 'ismapped', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
751 def winfo_manager(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
752 """Return the window mananger name for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
753 return self.tk.call('winfo', 'manager', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
754 def winfo_name(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
755 """Return the name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
756 return self.tk.call('winfo', 'name', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
757 def winfo_parent(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
758 """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
|
759 return self.tk.call('winfo', 'parent', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
760 def winfo_pathname(self, id, displayof=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
761 """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
|
762 args = ('winfo', 'pathname') \ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
763 + self._displayof(displayof) + (id,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
764 return self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
765 def winfo_pixels(self, number): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
766 """Rounded integer value of winfo_fpixels.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
767 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
768 self.tk.call('winfo', 'pixels', self._w, number)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
769 def winfo_pointerx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
770 """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
|
771 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
772 self.tk.call('winfo', 'pointerx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
773 def winfo_pointerxy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
774 """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
|
775 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
776 self.tk.call('winfo', 'pointerxy', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
777 def winfo_pointery(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
778 """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
|
779 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
780 self.tk.call('winfo', 'pointery', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
781 def winfo_reqheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
782 """Return requested height of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
783 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
784 self.tk.call('winfo', 'reqheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
785 def winfo_reqwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
786 """Return requested width of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
787 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
788 self.tk.call('winfo', 'reqwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
789 def winfo_rgb(self, color): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
790 """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
|
791 COLOR in this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
792 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
793 self.tk.call('winfo', 'rgb', self._w, color)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
794 def winfo_rootx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
795 """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
|
796 root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
797 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
798 self.tk.call('winfo', 'rootx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
799 def winfo_rooty(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
800 """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
|
801 root window.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
802 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
803 self.tk.call('winfo', 'rooty', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
804 def winfo_screen(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
805 """Return the screen name 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', 'screen', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
807 def winfo_screencells(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
808 """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
|
809 of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
810 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
811 self.tk.call('winfo', 'screencells', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
812 def winfo_screendepth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
813 """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
|
814 screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
815 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
816 self.tk.call('winfo', 'screendepth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
817 def winfo_screenheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
818 """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
|
819 in pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
820 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
821 self.tk.call('winfo', 'screenheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
822 def winfo_screenmmheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
823 """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
|
824 this widget in mm.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
825 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
826 self.tk.call('winfo', 'screenmmheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
827 def winfo_screenmmwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
828 """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
|
829 this widget in mm.""" |
|
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', 'screenmmwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
832 def winfo_screenvisual(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
833 """Return one of the strings directcolor, grayscale, pseudocolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
834 staticcolor, staticgray, or truecolor for the default |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
835 colormodel of this screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
836 return self.tk.call('winfo', 'screenvisual', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
837 def winfo_screenwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
838 """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
|
839 this widget in pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
840 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
841 self.tk.call('winfo', 'screenwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
842 def winfo_server(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
843 """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
|
844 the form "XmajorRminor vendor vendorVersion".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
845 return self.tk.call('winfo', 'server', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
846 def winfo_toplevel(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
847 """Return the toplevel widget of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
848 return self._nametowidget(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
849 'winfo', 'toplevel', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
850 def winfo_viewable(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
851 """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
|
852 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
853 self.tk.call('winfo', 'viewable', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
854 def winfo_visual(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
855 """Return one of the strings directcolor, grayscale, pseudocolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
856 staticcolor, staticgray, or truecolor for the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
857 colormodel of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
858 return self.tk.call('winfo', 'visual', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
859 def winfo_visualid(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
860 """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
|
861 return self.tk.call('winfo', 'visualid', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
862 def winfo_visualsavailable(self, includeids=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
863 """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
|
864 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
|
865 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
866 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
|
867 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
|
868 data = self.tk.split( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
869 self.tk.call('winfo', 'visualsavailable', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
870 includeids and 'includeids' or None)) |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
871 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
|
872 data = [self.tk.split(data)] |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
873 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
|
874 def __winfo_parseitem(self, t): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
875 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
876 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
|
877 def __winfo_getint(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
878 """Internal function.""" |
|
16517
eee67a84e5fa
String method conversion.
Eric S. Raymond <esr@thyrsus.com>
parents:
15540
diff
changeset
|
879 return int(x, 0) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
880 def winfo_vrootheight(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
881 """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
|
882 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
|
883 height of the screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
884 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
885 self.tk.call('winfo', 'vrootheight', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
886 def winfo_vrootwidth(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
887 """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
|
888 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
|
889 width of the screen.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
890 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
891 self.tk.call('winfo', 'vrootwidth', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
892 def winfo_vrootx(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
893 """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
|
894 window of the screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
895 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
896 self.tk.call('winfo', 'vrootx', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
897 def winfo_vrooty(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
898 """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
|
899 window of the screen of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
900 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
901 self.tk.call('winfo', 'vrooty', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
902 def winfo_width(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
903 """Return the width of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
904 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
905 self.tk.call('winfo', 'width', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
906 def winfo_x(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
907 """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
|
908 in the parent.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
909 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
910 self.tk.call('winfo', 'x', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
911 def winfo_y(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
912 """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
|
913 in the parent.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
914 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
915 self.tk.call('winfo', 'y', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
916 def update(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
917 """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
|
918 self.tk.call('update') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
919 def update_idletasks(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
920 """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
|
921 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
|
922 the user.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
923 self.tk.call('update', 'idletasks') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
924 def bindtags(self, tagList=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
925 """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
|
926 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
927 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
|
928 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
|
929 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
|
930 processed (see bind).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
931 if tagList is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
932 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
933 self.tk.call('bindtags', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
934 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
935 self.tk.call('bindtags', self._w, tagList) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
936 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
|
937 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
938 if isinstance(func, str): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
939 self.tk.call(what + (sequence, func)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
940 elif func: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
941 funcid = self._register(func, self._substitute, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
942 needcleanup) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
943 cmd = ('%sif {"[%s %s]" == "break"} break\n' |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
944 % |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
945 (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
|
946 funcid, self._subst_format_str)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
947 self.tk.call(what + (sequence, cmd)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
948 return funcid |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
949 elif sequence: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
950 return self.tk.call(what + (sequence,)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
951 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
952 return self.tk.splitlist(self.tk.call(what)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
953 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
|
954 """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
|
955 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
956 SEQUENCE is a string of concatenated event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
957 patterns. An event pattern is of the form |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
958 <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
959 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
|
960 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
|
961 B3, Alt, Button4, B4, Double, Button5, B5 Triple, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
962 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
|
963 ButtonPress, Button, Expose, Motion, ButtonRelease |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
964 FocusIn, MouseWheel, Circulate, FocusOut, Property, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
965 Colormap, Gravity Reparent, Configure, KeyPress, Key, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
966 Unmap, Deactivate, KeyRelease Visibility, Destroy, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
967 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
|
968 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
|
969 KeyRelease. Examples are |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
970 <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
|
971 <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
|
972 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
|
973 <<AString>> where AString can be arbitrary. This |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
974 event can be generated by event_generate. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
975 If events are concatenated they must appear shortly |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
976 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
|
977 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
978 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
|
979 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
|
980 "break" no further bound function is invoked. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
981 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
982 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
|
983 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
|
984 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
|
985 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
986 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
|
987 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
|
988 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
989 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
|
990 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
|
991 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
992 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
|
993 def unbind(self, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
994 """Unbind for this widget for event SEQUENCE the |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
995 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
996 self.tk.call('bind', self._w, sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
997 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
998 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
999 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
|
1000 """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
|
1001 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
|
1002 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
|
1003 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
|
1004 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
|
1005 def unbind_all(self, sequence): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1006 """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
|
1007 self.tk.call('bind', 'all' , sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1008 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
|
1009 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1010 """Bind to widgets with bindtag CLASSNAME at event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1011 SEQUENCE a call of function FUNC. An additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1012 boolean parameter ADD specifies whether FUNC will be |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1013 called additionally to the other bound function or |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1014 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
|
1015 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
|
1016 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1017 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
|
1018 def unbind_class(self, className, sequence): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1019 """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
|
1020 all functions.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1021 self.tk.call('bind', className , sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1022 def mainloop(self, n=0): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1023 """Call the mainloop of Tk.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1024 self.tk.mainloop(n) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1025 def quit(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1026 """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
|
1027 self.tk.quit() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1028 def _getints(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1029 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1030 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1031 return tuple(map(getint, self.tk.splitlist(string))) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1032 def _getdoubles(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1033 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1034 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1035 return tuple(map(getdouble, self.tk.splitlist(string))) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1036 def _getboolean(self, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1037 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1038 if string: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1039 return self.tk.getboolean(string) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1040 def _displayof(self, displayof): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1041 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1042 if displayof: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1043 return ('-displayof', displayof) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1044 if displayof is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1045 return ('-displayof', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1046 return () |
|
76975
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1047 @property |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1048 def _windowingsystem(self): |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1049 """Internal function.""" |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1050 try: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1051 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
|
1052 except AttributeError: |
|
41382250e5e1
Issue #14777: In an X11 windowing environment, tkinter may return
Ned Deily <nad@acm.org>
parents:
73165
diff
changeset
|
1053 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
|
1054 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
|
1055 return ws |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1056 def _options(self, cnf, kw = None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1057 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1058 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1059 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1060 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1061 cnf = _cnfmerge(cnf) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1062 res = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1063 for k, v in cnf.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1064 if v is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1065 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
|
1066 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1067 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
|
1068 elif isinstance(v, (tuple, list)): |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1069 nv = [] |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1070 for item in v: |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1071 if isinstance(item, int): |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1072 nv.append(str(item)) |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1073 elif isinstance(item, str): |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1074 nv.append(('{%s}' if ' ' in item else '%s') % item) |
|
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1075 else: |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1076 break |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1077 else: |
|
47455
a76e49b219a2
Fix Tkinter sequence passing. #2906.
Georg Brandl <georg@python.org>
parents:
47384
diff
changeset
|
1078 v = ' '.join(nv) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1079 res = res + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1080 return res |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1081 def nametowidget(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1082 """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
|
1083 its Tcl name NAME.""" |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1084 name = str(name).split('.') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1085 w = self |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1086 |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1087 if not name[0]: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1088 w = w._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1089 name = name[1:] |
|
48619
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1090 |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1091 for n in name: |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1092 if not n: |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1093 break |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1094 w = w.children[n] |
|
d587aa5e824d
Merged revisions 65399 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
48592
diff
changeset
|
1095 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1096 return w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1097 _nametowidget = nametowidget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1098 def _register(self, func, subst=None, needcleanup=1): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1099 """Return a newly created Tcl function. If this |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1100 function is called, the Python function FUNC will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1101 be executed. An optional function SUBST can |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1102 be given which will be executed before FUNC.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1103 f = CallWrapper(func, subst, self).__call__ |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
1104 name = repr(id(f)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1105 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
|
1106 func = func.__func__ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1107 except AttributeError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1108 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1109 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1110 name = name + func.__name__ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1111 except AttributeError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1112 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1113 self.tk.createcommand(name, f) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1114 if needcleanup: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1115 if self._tclCommands is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1116 self._tclCommands = [] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1117 self._tclCommands.append(name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1118 return name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1119 register = _register |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1120 def _root(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1121 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1122 w = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1123 while w.master: w = w.master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1124 return w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1125 _subst_format = ('%#', '%b', '%f', '%h', '%k', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1126 '%s', '%t', '%w', '%x', '%y', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1127 '%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
|
1128 _subst_format_str = " ".join(_subst_format) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1129 def _substitute(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1130 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1131 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
|
1132 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
|
1133 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1134 getint = int |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1135 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
|
1136 """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
|
1137 try: |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1138 return int(s) |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1139 except ValueError: |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1140 return s |
|
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1141 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1142 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
|
1143 # 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
|
1144 e = Event() |
|
28435
ee1c709050b2
Patch #707701: Expect '??' in event fields. Fixes #698517.
Martin v. Löwis <martin@v.loewis.de>
parents:
27341
diff
changeset
|
1145 # 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
|
1146 # 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
|
1147 # 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
|
1148 # 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
|
1149 # 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
|
1150 # 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
|
1151 # 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
|
1152 # 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
|
1153 # 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
|
1154 # 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
|
1155 # 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
|
1156 # 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
|
1157 # KeyRelease,and Motion events |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1158 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
|
1159 e.num = getint_event(b) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1160 try: e.focus = getboolean(f) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1161 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
|
1162 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
|
1163 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
|
1164 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
|
1165 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
|
1166 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
|
1167 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
|
1168 e.y = getint_event(y) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1169 e.char = A |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1170 try: e.send_event = getboolean(E) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1171 except TclError: pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1172 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
|
1173 e.keysym_num = getint_event(N) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1174 e.type = T |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1175 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1176 e.widget = self._nametowidget(W) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1177 except KeyError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1178 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
|
1179 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
|
1180 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
|
1181 try: |
|
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1182 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
|
1183 except ValueError: |
|
0d1025aefebf
Older Tk versions don't support mousewheel support. Set event.delta
Fredrik Lundh <fredrik@pythonware.com>
parents:
13907
diff
changeset
|
1184 e.delta = 0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1185 return (e,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1186 def _report_exception(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1187 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1188 import sys |
|
37042
7ada16a14968
Remove sys.exc_type, sys.exc_value, sys.exc_traceback
Neal Norwitz <nnorwitz@gmail.com>
parents:
35850
diff
changeset
|
1189 exc, val, tb = sys.exc_info() |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1190 root = self._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1191 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
|
1192 def _configure(self, cmd, cnf, kw): |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1193 """Internal function.""" |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1194 if kw: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1195 cnf = _cnfmerge((cnf, kw)) |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1196 elif cnf: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1197 cnf = _cnfmerge(cnf) |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1198 if cnf is None: |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1199 cnf = {} |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1200 for x in self.tk.split( |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1201 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
|
1202 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
|
1203 return cnf |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
1204 if isinstance(cnf, str): |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1205 x = self.tk.split( |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1206 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
|
1207 return (x[0][1:],) + x[1:] |
|
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1208 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
|
1209 # These used to be defined in Widget: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1210 def configure(self, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1211 """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
|
1212 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1213 The values for resources are specified as keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1214 arguments. To get an overview about |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1215 the allowed keyword arguments call the method keys. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1216 """ |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
1217 return self._configure('configure', cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1218 config = configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1219 def cget(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1220 """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
|
1221 return self.tk.call(self._w, 'cget', '-' + key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1222 __getitem__ = cget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1223 def __setitem__(self, key, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1224 self.configure({key: value}) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1225 def keys(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1226 """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
|
1227 return [x[0][1:] for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1228 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
|
1229 def __str__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1230 """Return the window path name of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1231 return self._w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1232 # Pack methods that apply to the master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1233 _noarg_ = ['_noarg_'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1234 def pack_propagate(self, flag=_noarg_): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1235 """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
|
1236 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1237 A boolean argument specifies whether the geometry information |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1238 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
|
1239 is given the current setting will be returned. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1240 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1241 if flag is Misc._noarg_: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1242 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1243 'pack', 'propagate', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1244 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1245 self.tk.call('pack', 'propagate', self._w, flag) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1246 propagate = pack_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1247 def pack_slaves(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1248 """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
|
1249 in its packing order.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1250 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1251 self.tk.splitlist( |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1252 self.tk.call('pack', 'slaves', self._w))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1253 slaves = pack_slaves |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1254 # Place method that applies to the master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1255 def place_slaves(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1256 """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
|
1257 in its packing order.""" |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1258 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1259 self.tk.splitlist( |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1260 self.tk.call( |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1261 'place', 'slaves', self._w))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1262 # Grid methods that apply to the master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1263 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
|
1264 """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
|
1265 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
|
1266 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1267 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
|
1268 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
|
1269 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
|
1270 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
|
1271 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1272 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
|
1273 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
|
1274 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1275 args = ('grid', 'bbox', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1276 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
|
1277 args = args + (column, row) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1278 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
|
1279 args = args + (col2, row2) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1280 return self._getints(self.tk.call(*args)) or None |
|
9636
e58957f06a15
grid_bbox(): support new Tk API: grid bbox ?column row? ?column2 row2?
Barry Warsaw <barry@python.org>
parents:
9357
diff
changeset
|
1281 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1282 bbox = grid_bbox |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1283 def _grid_configure(self, command, index, cnf, kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1284 """Internal function.""" |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
1285 if isinstance(cnf, str) and not kw: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1286 if cnf[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1287 cnf = cnf[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1288 if cnf[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1289 cnf = '-'+cnf |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1290 options = (cnf,) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1291 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1292 options = self._options(cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1293 if not options: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1294 res = self.tk.call('grid', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1295 command, self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1296 words = self.tk.splitlist(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1297 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1298 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1299 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1300 value = words[i+1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1301 if not value: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1302 value = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1303 elif '.' in value: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1304 value = getdouble(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1305 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1306 value = getint(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1307 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1308 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1309 res = self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1310 ('grid', command, self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1311 + options) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1312 if len(options) == 1: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1313 if not res: return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1314 # 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
|
1315 if '.' in res: return getdouble(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1316 return getint(res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1317 def grid_columnconfigure(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1318 """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
|
1319 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1320 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
|
1321 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
|
1322 and pad (how much space to let additionally).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1323 return self._grid_configure('columnconfigure', index, cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1324 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
|
1325 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
|
1326 """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
|
1327 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
|
1328 widget is located.""" |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1329 return self._getints( |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1330 self.tk.call( |
|
e4d0b1f94eca
Move grid_location into Misc. Fixes bug #426892.
Martin v. Löwis <martin@v.loewis.de>
parents:
20198
diff
changeset
|
1331 '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
|
1332 def grid_propagate(self, flag=_noarg_): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1333 """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
|
1334 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1335 A boolean argument specifies whether the geometry information |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1336 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
|
1337 is given, the current setting will be returned. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1338 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1339 if flag is Misc._noarg_: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1340 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1341 'grid', 'propagate', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1342 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1343 self.tk.call('grid', 'propagate', self._w, flag) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1344 def grid_rowconfigure(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1345 """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
|
1346 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1347 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
|
1348 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
|
1349 and pad (how much space to let additionally).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1350 return self._grid_configure('rowconfigure', index, cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1351 rowconfigure = grid_rowconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1352 def grid_size(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1353 """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
|
1354 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1355 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
|
1356 size = grid_size |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1357 def grid_slaves(self, row=None, column=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1358 """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
|
1359 in its packing order.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1360 args = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1361 if row is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1362 args = args + ('-row', row) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1363 if column is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1364 args = args + ('-column', column) |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1365 return [self._nametowidget(x) for x in |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1366 self.tk.splitlist(self.tk.call( |
|
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1367 ('grid', 'slaves', self._w) + args))] |
| 1664 | 1368 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1369 # 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
|
1370 # 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
|
1371 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1372 def event_add(self, virtual, *sequences): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1373 """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
|
1374 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
|
1375 whenever SEQUENCE occurs.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1376 args = ('event', 'add', virtual) + sequences |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1377 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
|
1378 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1379 def event_delete(self, virtual, *sequences): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1380 """Unbind a virtual event VIRTUAL from SEQUENCE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1381 args = ('event', 'delete', virtual) + sequences |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1382 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
|
1383 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1384 def event_generate(self, sequence, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1385 """Generate an event SEQUENCE. Additional |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1386 keyword arguments specify parameter of the event |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1387 (e.g. x, y, rootx, rooty).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1388 args = ('event', 'generate', self._w, sequence) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1389 for k, v in kw.items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1390 args = args + ('-%s' % k, str(v)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1391 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
|
1392 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1393 def event_info(self, virtual=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1394 """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
|
1395 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
|
1396 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1397 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
|
1398 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1399 # 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
|
1400 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1401 def image_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1402 """Return a list of all existing image names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1403 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
|
1404 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1405 def image_types(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1406 """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
|
1407 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
|
1408 |
|
6712
ff16448e8f24
Support for the "event" command, new in Tk 4.2.
Guido van Rossum <guido@python.org>
parents:
6625
diff
changeset
|
1409 |
|
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
|
1410 class CallWrapper: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1411 """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
|
1412 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
|
1413 def __init__(self, func, subst, widget): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1414 """Store FUNC, SUBST and WIDGET as members.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1415 self.func = func |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1416 self.subst = subst |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1417 self.widget = widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1418 def __call__(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1419 """Apply first function SUBST to arguments, than FUNC.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1420 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1421 if self.subst: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1422 args = self.subst(*args) |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1423 return self.func(*args) |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
1424 except SystemExit as msg: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1425 raise SystemExit(msg) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1426 except: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1427 self.widget._report_exception() |
| 1664 | 1428 |
|
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
|
1429 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1430 class XView: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1431 """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
|
1432 of a widget's window.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1433 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1434 def xview(self, *args): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1435 """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
|
1436 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
|
1437 if not args: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1438 return self._getdoubles(res) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1439 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1440 def xview_moveto(self, fraction): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1441 """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
|
1442 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
|
1443 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
|
1444 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1445 def xview_scroll(self, number, what): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1446 """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
|
1447 or "pages" (WHAT).""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1448 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
|
1449 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1450 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1451 class YView: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1452 """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
|
1453 of a widget's window.""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1454 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1455 def yview(self, *args): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1456 """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
|
1457 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
|
1458 if not args: |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1459 return self._getdoubles(res) |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1460 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1461 def yview_moveto(self, fraction): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1462 """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
|
1463 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
|
1464 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
|
1465 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1466 def yview_scroll(self, number, what): |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1467 """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
|
1468 "units" or "pages" (WHAT).""" |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1469 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
|
1470 |
|
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
1471 |
| 1664 | 1472 class Wm: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1473 """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
|
1474 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1475 def wm_aspect(self, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1476 minNumer=None, minDenom=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1477 maxNumer=None, maxDenom=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1478 """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
|
1479 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
|
1480 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
|
1481 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1482 self.tk.call('wm', 'aspect', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1483 minNumer, minDenom, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1484 maxNumer, maxDenom)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1485 aspect = wm_aspect |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1486 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1487 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
|
1488 """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
|
1489 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1490 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
|
1491 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
|
1492 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
|
1493 are as follows: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1494 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1495 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
|
1496 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
|
1497 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
|
1498 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
|
1499 windows). |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1500 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1501 On Macintosh, XXXXX |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1502 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1503 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
|
1504 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
1505 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
|
1506 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
|
1507 attributes=wm_attributes |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
1508 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1509 def wm_client(self, name=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1510 """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
|
1511 current value.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1512 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
|
1513 client = wm_client |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1514 def wm_colormapwindows(self, *wlist): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1515 """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
|
1516 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
|
1517 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
|
1518 if len(wlist) > 1: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1519 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
|
1520 args = ('wm', 'colormapwindows', self._w) + wlist |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
1521 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
|
1522 colormapwindows = wm_colormapwindows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1523 def wm_command(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1524 """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
|
1525 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
|
1526 command if VALUE is None.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1527 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
|
1528 command = wm_command |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1529 def wm_deiconify(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1530 """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
|
1531 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
|
1532 return self.tk.call('wm', 'deiconify', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1533 deiconify = wm_deiconify |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1534 def wm_focusmodel(self, model=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1535 """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
|
1536 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
|
1537 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
|
1538 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
|
1539 focusmodel = wm_focusmodel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1540 def wm_frame(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1541 """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
|
1542 return self.tk.call('wm', 'frame', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1543 frame = wm_frame |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1544 def wm_geometry(self, newGeometry=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1545 """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
|
1546 current value if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1547 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
|
1548 geometry = wm_geometry |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1549 def wm_grid(self, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1550 baseWidth=None, baseHeight=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1551 widthInc=None, heightInc=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1552 """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
|
1553 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
|
1554 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
|
1555 number of grid units requested in Tk_GeometryRequest.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1556 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1557 'wm', 'grid', self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1558 baseWidth, baseHeight, widthInc, heightInc)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1559 grid = wm_grid |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1560 def wm_group(self, pathName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1561 """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
|
1562 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
|
1563 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
|
1564 group = wm_group |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1565 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
|
1566 """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
|
1567 the bitmap if None is given. |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1568 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1569 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
|
1570 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
|
1571 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
|
1572 (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
|
1573 documentation for more information.""" |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1574 if default: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1575 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
|
1576 else: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1577 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
|
1578 iconbitmap = wm_iconbitmap |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1579 def wm_iconify(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1580 """Display widget as icon.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1581 return self.tk.call('wm', 'iconify', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1582 iconify = wm_iconify |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1583 def wm_iconmask(self, bitmap=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1584 """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
|
1585 mask if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1586 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
|
1587 iconmask = wm_iconmask |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1588 def wm_iconname(self, newName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1589 """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
|
1590 None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1591 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
|
1592 iconname = wm_iconname |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1593 def wm_iconposition(self, x=None, y=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1594 """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
|
1595 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
|
1596 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1597 'wm', 'iconposition', self._w, x, y)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1598 iconposition = wm_iconposition |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1599 def wm_iconwindow(self, pathName=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1600 """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
|
1601 value if None is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1602 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
|
1603 iconwindow = wm_iconwindow |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1604 def wm_maxsize(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1605 """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
|
1606 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
|
1607 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1608 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1609 'wm', 'maxsize', self._w, width, height)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1610 maxsize = wm_maxsize |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1611 def wm_minsize(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1612 """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
|
1613 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
|
1614 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1615 return self._getints(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1616 'wm', 'minsize', self._w, width, height)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1617 minsize = wm_minsize |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1618 def wm_overrideredirect(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1619 """Instruct the window manager to ignore this widget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1620 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
|
1621 is given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1622 return self._getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1623 'wm', 'overrideredirect', self._w, boolean)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1624 overrideredirect = wm_overrideredirect |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1625 def wm_positionfrom(self, who=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1626 """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
|
1627 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
|
1628 "program".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1629 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
|
1630 positionfrom = wm_positionfrom |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1631 def wm_protocol(self, name=None, func=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1632 """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
|
1633 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
|
1634 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
|
1635 if callable(func): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1636 command = self._register(func) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1637 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1638 command = func |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1639 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1640 'wm', 'protocol', self._w, name, command) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1641 protocol = wm_protocol |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1642 def wm_resizable(self, width=None, height=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1643 """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
|
1644 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
|
1645 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
|
1646 resizable = wm_resizable |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1647 def wm_sizefrom(self, who=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1648 """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
|
1649 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
|
1650 "program".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1651 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
|
1652 sizefrom = wm_sizefrom |
|
13906
c45accc8e6d0
-- added optional newstate argument to Wm.state. The newstate arg
Fredrik Lundh <fredrik@pythonware.com>
parents:
13905
diff
changeset
|
1653 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
|
1654 """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
|
1655 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
|
1656 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
|
1657 state = wm_state |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1658 def wm_title(self, string=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1659 """Set the title of this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1660 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
|
1661 title = wm_title |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1662 def wm_transient(self, master=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1663 """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
|
1664 with regard to widget MASTER.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1665 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
|
1666 transient = wm_transient |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1667 def wm_withdraw(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1668 """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
|
1669 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
|
1670 return self.tk.call('wm', 'withdraw', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1671 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
|
1672 |
| 1664 | 1673 |
| 1674 class Tk(Misc, Wm): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1675 """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
|
1676 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
|
1677 _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
|
1678 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
|
1679 useTk=1, sync=0, use=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1680 """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
|
1681 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
|
1682 readprofile). |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1683 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
|
1684 is the name of the widget class.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1685 self.master = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1686 self.children = {} |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1687 self._tkloaded = 0 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1688 # 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
|
1689 # ensure that self.tk is always _something_. |
|
32736
c3a096bfbd6b
Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents:
31547
diff
changeset
|
1690 self.tk = None |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1691 if baseName is None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1692 import sys, os |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1693 baseName = os.path.basename(sys.argv[0]) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1694 baseName, ext = os.path.splitext(baseName) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1695 if ext not in ('.py', '.pyc', '.pyo'): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1696 baseName = baseName + ext |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1697 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
|
1698 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
|
1699 if useTk: |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1700 self._loadtk() |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1701 self.readprofile(baseName, className) |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1702 def loadtk(self): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1703 if not self._tkloaded: |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1704 self.tk.loadtk() |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1705 self._loadtk() |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1706 def _loadtk(self): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1707 self._tkloaded = 1 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1708 global _default_root |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1709 # Version sanity checks |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1710 tk_version = self.tk.getvar('tk_version') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1711 if tk_version != _tkinter.TK_VERSION: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1712 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
|
1713 % (_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
|
1714 # 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
|
1715 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
|
1716 if tcl_version != _tkinter.TCL_VERSION: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1717 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
|
1718 % (_tkinter.TCL_VERSION, tcl_version)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1719 if TkVersion < 4.0: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
1720 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
|
1721 % str(TkVersion)) |
|
34642
b5a25c56a852
Patch #1121234: Properly cleanup _exit and tkerror commands.
Martin v. Löwis <martin@v.loewis.de>
parents:
32941
diff
changeset
|
1722 # 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
|
1723 # 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
|
1724 # 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
|
1725 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
|
1726 self._tclCommands = [] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1727 self.tk.createcommand('tkerror', _tkerror) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1728 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
|
1729 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
|
1730 self._tclCommands.append('exit') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1731 if _support_default_root and not _default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1732 _default_root = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1733 self.protocol("WM_DELETE_WINDOW", self.destroy) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1734 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1735 """Destroy this and all descendants widgets. This will |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1736 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
|
1737 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
|
1738 self.tk.call('destroy', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1739 Misc.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1740 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1741 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
|
1742 _default_root = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1743 def readprofile(self, baseName, className): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1744 """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
|
1745 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
|
1746 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
|
1747 import os |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
1748 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
|
1749 else: home = os.curdir |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1750 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
|
1751 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
|
1752 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
|
1753 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
|
1754 dir = {'self': self} |
|
47130
ef4cca2d6171
Tkinter, step 2: adapt imports.
Georg Brandl <georg@python.org>
parents:
47129
diff
changeset
|
1755 exec('from tkinter import *', dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1756 if os.path.isfile(class_tcl): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1757 self.tk.call('source', class_tcl) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1758 if os.path.isfile(class_py): |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1759 exec(open(class_py).read(), dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1760 if os.path.isfile(base_tcl): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1761 self.tk.call('source', base_tcl) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1762 if os.path.isfile(base_py): |
|
42552
ac192f89c109
Kill execfile(), use exec() instead
Neal Norwitz <nnorwitz@gmail.com>
parents:
42309
diff
changeset
|
1763 exec(open(base_py).read(), dir) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1764 def report_callback_exception(self, exc, val, tb): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1765 """Internal function. It reports exception on sys.stderr.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1766 import traceback, sys |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1767 sys.stderr.write("Exception in Tkinter callback\n") |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1768 sys.last_type = exc |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1769 sys.last_value = val |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1770 sys.last_traceback = tb |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1771 traceback.print_exception(exc, val, tb) |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1772 def __getattr__(self, attr): |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1773 "Delegate attribute access to the interpreter object" |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1774 return getattr(self.tk, attr) |
| 1664 | 1775 |
| 6571 | 1776 # Ideally, the classes Pack, Place and Grid disappear, the |
| 1777 # pack/place/grid methods are defined on the Widget class, and | |
| 1778 # everybody uses w.pack_whatever(...) instead of Pack.whatever(w, | |
| 1779 # ...), with pack(), place() and grid() being short for | |
| 1780 # pack_configure(), place_configure() and grid_columnconfigure(), and | |
| 1781 # forget() being short for pack_forget(). As a practical matter, I'm | |
| 1782 # afraid that there is too much code out there that may be using the | |
| 1783 # Pack, Place or Grid class, so I leave them intact -- but only as | |
| 1784 # backwards compatibility features. Also note that those methods that | |
| 1785 # take a master as argument (e.g. pack_propagate) have been moved to | |
| 1786 # the Misc class (which now incorporates all methods common between | |
| 1787 # toplevel and interior widgets). Again, for compatibility, these are | |
| 1788 # copied into the Pack, Place or Grid class. | |
| 1789 | |
|
31547
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1790 |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1791 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
|
1792 return Tk(screenName, baseName, className, useTk) |
|
470f95ad6750
Implementation of patch 869468
David Ascher <david.ascher@gmail.com>
parents:
31515
diff
changeset
|
1793 |
| 1664 | 1794 class Pack: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1795 """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
|
1796 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1797 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
|
1798 def pack_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1799 """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
|
1800 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
|
1801 anchor=NSEW (or subset) - position widget according to |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1802 given direction |
|
47366
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1803 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
|
1804 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
|
1805 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
|
1806 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
|
1807 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1808 ipadx=amount - add internal padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1809 ipady=amount - add internal padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1810 padx=amount - add padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1811 pady=amount - add padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1812 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
|
1813 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1814 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1815 ('pack', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1816 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1817 pack = configure = config = pack_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1818 def pack_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1819 """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
|
1820 self.tk.call('pack', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1821 forget = pack_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1822 def pack_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1823 """Return information about the packing options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1824 for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1825 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1826 self.tk.call('pack', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1827 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1828 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1829 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1830 value = words[i+1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1831 if value[:1] == '.': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1832 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1833 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1834 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1835 info = pack_info |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1836 propagate = pack_propagate = Misc.pack_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1837 slaves = pack_slaves = Misc.pack_slaves |
| 1664 | 1838 |
| 1839 class Place: | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1840 """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
|
1841 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1842 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
|
1843 def place_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1844 """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
|
1845 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
|
1846 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1847 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
|
1848 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
|
1849 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
|
1850 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
|
1851 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
|
1852 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
|
1853 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
|
1854 width=amount - width of this widget in pixel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1855 height=amount - height of this widget in pixel |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1856 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
|
1857 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
|
1858 as the master) |
|
b6cbec499756
#2906: accept lists for options, and some cosmetic fixes in Tkinter.
Georg Brandl <georg@python.org>
parents:
47278
diff
changeset
|
1859 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
|
1860 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
|
1861 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
|
1862 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
|
1863 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
|
1864 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1865 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1866 ('place', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1867 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1868 place = configure = config = place_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1869 def place_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1870 """Unmap this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1871 self.tk.call('place', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1872 forget = place_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1873 def place_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1874 """Return information about the placing options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1875 for this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1876 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1877 self.tk.call('place', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1878 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1879 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1880 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1881 value = words[i+1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1882 if value[:1] == '.': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1883 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1884 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1885 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1886 info = place_info |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1887 slaves = place_slaves = Misc.place_slaves |
| 1664 | 1888 |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
1889 class Grid: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1890 """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
|
1891 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1892 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
|
1893 # Thanks to Masazumi Yoshikawa (yosikawa@isi.edu) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1894 def grid_configure(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1895 """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
|
1896 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
|
1897 columnspan=number - this widget will span several columns |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1898 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
|
1899 in_=master - see 'in' option description |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1900 ipadx=amount - add internal padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1901 ipady=amount - add internal padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1902 padx=amount - add padding in x direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1903 pady=amount - add padding in y direction |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1904 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
|
1905 rowspan=number - this widget will span several rows |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1906 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
|
1907 widget stick to the cell boundary |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1908 """ |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1909 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1910 ('grid', 'configure', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1911 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1912 grid = configure = config = grid_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1913 bbox = grid_bbox = Misc.grid_bbox |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1914 columnconfigure = grid_columnconfigure = Misc.grid_columnconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1915 def grid_forget(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1916 """Unmap this widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1917 self.tk.call('grid', 'forget', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1918 forget = grid_forget |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1919 def grid_remove(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1920 """Unmap this widget but remember the grid options.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1921 self.tk.call('grid', 'remove', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1922 def grid_info(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1923 """Return information about the options |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1924 for positioning this widget in a grid.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1925 words = self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1926 self.tk.call('grid', 'info', self._w)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1927 dict = {} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1928 for i in range(0, len(words), 2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1929 key = words[i][1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1930 value = words[i+1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1931 if value[:1] == '.': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1932 value = self._nametowidget(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1933 dict[key] = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1934 return dict |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1935 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
|
1936 location = grid_location = Misc.grid_location |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1937 propagate = grid_propagate = Misc.grid_propagate |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1938 rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1939 size = grid_size = Misc.grid_size |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1940 slaves = grid_slaves = Misc.grid_slaves |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
1941 |
| 6571 | 1942 class BaseWidget(Misc): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1943 """Internal class.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1944 def _setup(self, master, cnf): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1945 """Internal function. Sets up information about children.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1946 if _support_default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1947 global _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1948 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1949 if not _default_root: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1950 _default_root = Tk() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1951 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1952 self.master = master |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1953 self.tk = master.tk |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1954 name = None |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
1955 if 'name' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1956 name = cnf['name'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1957 del cnf['name'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1958 if not name: |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
1959 name = repr(id(self)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1960 self._name = name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1961 if master._w=='.': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1962 self._w = '.' + name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1963 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1964 self._w = master._w + '.' + name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1965 self.children = {} |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
1966 if self._name in self.master.children: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1967 self.master.children[self._name].destroy() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1968 self.master.children[self._name] = self |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1969 def __init__(self, master, widgetName, cnf={}, kw={}, extra=()): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1970 """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
|
1971 and appropriate options.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1972 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1973 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1974 self.widgetName = widgetName |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1975 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
|
1976 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
|
1977 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
|
1978 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
|
1979 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
|
1980 del cnf[k] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1981 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1982 (widgetName, self._w) + extra + self._options(cnf)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1983 for k, v in classes: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1984 k.configure(self, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1985 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1986 """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
|
1987 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
|
1988 self.tk.call('destroy', self._w) |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
1989 if self._name in self.master.children: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1990 del self.master.children[self._name] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1991 Misc.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1992 def _do(self, name, args=()): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1993 # XXX Obsolete -- better use self.tk.call directly! |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1994 return self.tk.call((self._w, name) + args) |
| 1664 | 1995 |
| 6571 | 1996 class Widget(BaseWidget, Pack, Place, Grid): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1997 """Internal class. |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
1998 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
1999 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
|
2000 Pack, Place or Grid.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2001 pass |
| 6571 | 2002 |
| 2003 class Toplevel(BaseWidget, Wm): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2004 """Toplevel widget, e.g. for dialogs.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2005 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2006 """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
|
2007 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2008 Valid resource names: background, bd, bg, borderwidth, class, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2009 colormap, container, cursor, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2010 highlightcolor, highlightthickness, menu, relief, screen, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2011 use, visual, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2012 if kw: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2013 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2014 extra = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2015 for wmkey in ['screen', 'class_', 'class', 'visual', |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2016 'colormap']: |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2017 if wmkey in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2018 val = cnf[wmkey] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2019 # TBD: a hack needed because some keys |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2020 # are not valid as keyword arguments |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2021 if wmkey[-1] == '_': opt = '-'+wmkey[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2022 else: opt = '-'+wmkey |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2023 extra = extra + (opt, val) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2024 del cnf[wmkey] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2025 BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2026 root = self._root() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2027 self.iconname(root.iconname()) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2028 self.title(root.title()) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2029 self.protocol("WM_DELETE_WINDOW", self.destroy) |
| 1664 | 2030 |
| 2031 class Button(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2032 """Button widget.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2033 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2034 """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
|
2035 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2036 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2037 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2038 activebackground, activeforeground, anchor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2039 background, bitmap, borderwidth, cursor, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2040 disabledforeground, font, foreground |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2041 highlightbackground, highlightcolor, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2042 highlightthickness, image, justify, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2043 padx, pady, relief, repeatdelay, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2044 repeatinterval, takefocus, text, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2045 textvariable, underline, wraplength |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2046 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2047 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2048 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2049 command, compound, default, height, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2050 overrelief, state, width |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2051 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2052 Widget.__init__(self, master, 'button', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2053 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2054 def tkButtonEnter(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2055 self.tk.call('tkButtonEnter', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2056 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2057 def tkButtonLeave(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2058 self.tk.call('tkButtonLeave', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2059 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2060 def tkButtonDown(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2061 self.tk.call('tkButtonDown', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2062 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2063 def tkButtonUp(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2064 self.tk.call('tkButtonUp', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2065 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2066 def tkButtonInvoke(self, *dummy): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2067 self.tk.call('tkButtonInvoke', self._w) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2068 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2069 def flash(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2070 """Flash the button. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2071 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2072 This is accomplished by redisplaying |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2073 the button several times, alternating between active and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2074 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
|
2075 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
|
2076 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
|
2077 disabled. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2078 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2079 self.tk.call(self._w, 'flash') |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2080 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2081 def invoke(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2082 """Invoke the command associated with the button. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2083 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2084 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
|
2085 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
|
2086 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
|
2087 is disabled. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2088 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2089 return self.tk.call(self._w, 'invoke') |
| 1664 | 2090 |
| 2091 # Indices: | |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
2092 # XXX I don't like these -- take them away |
| 1664 | 2093 def AtEnd(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2094 return 'end' |
|
1669
273451892327
Added getdouble, getboolean.
Guido van Rossum <guido@python.org>
parents:
1666
diff
changeset
|
2095 def AtInsert(*args): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2096 s = 'insert' |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2097 for a in args: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2098 if a: s = s + (' ' + a) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2099 return s |
| 1664 | 2100 def AtSelFirst(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2101 return 'sel.first' |
| 1664 | 2102 def AtSelLast(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2103 return 'sel.last' |
| 1664 | 2104 def At(x, y=None): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2105 if y is None: |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
2106 return '@%r' % (x,) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2107 else: |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
2108 return '@%r,%r' % (x, y) |
| 1664 | 2109 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2110 class Canvas(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2111 """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
|
2112 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2113 """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
|
2114 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2115 Valid resource names: background, bd, bg, borderwidth, closeenough, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2116 confine, cursor, height, highlightbackground, highlightcolor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2117 highlightthickness, insertbackground, insertborderwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2118 insertofftime, insertontime, insertwidth, offset, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2119 scrollregion, selectbackground, selectborderwidth, selectforeground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2120 state, takefocus, width, xscrollcommand, xscrollincrement, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2121 yscrollcommand, yscrollincrement.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2122 Widget.__init__(self, master, 'canvas', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2123 def addtag(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2124 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2125 self.tk.call((self._w, 'addtag') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2126 def addtag_above(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2127 """Add tag NEWTAG to all items above TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2128 self.addtag(newtag, 'above', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2129 def addtag_all(self, newtag): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2130 """Add tag NEWTAG to all items.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2131 self.addtag(newtag, 'all') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2132 def addtag_below(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2133 """Add tag NEWTAG to all items below TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2134 self.addtag(newtag, 'below', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2135 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
|
2136 """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
|
2137 If several match take the top-most. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2138 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
|
2139 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
|
2140 self.addtag(newtag, 'closest', x, y, halo, start) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2141 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
|
2142 """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
|
2143 by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2144 self.addtag(newtag, 'enclosed', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2145 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
|
2146 """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
|
2147 defined by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2148 self.addtag(newtag, 'overlapping', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2149 def addtag_withtag(self, newtag, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2150 """Add tag NEWTAG to all items with TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2151 self.addtag(newtag, 'withtag', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2152 def bbox(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2153 """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
|
2154 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
|
2155 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2156 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
|
2157 def tag_unbind(self, tagOrId, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2158 """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
|
2159 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2160 self.tk.call(self._w, 'bind', tagOrId, sequence, '') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2161 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2162 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2163 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
|
2164 """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
|
2165 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2166 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
|
2167 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
|
2168 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
|
2169 return self._bind((self._w, 'bind', tagOrId), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2170 sequence, func, add) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2171 def canvasx(self, screenx, gridspacing=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2172 """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
|
2173 to nearest multiple of GRIDSPACING units.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2174 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2175 self._w, 'canvasx', screenx, gridspacing)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2176 def canvasy(self, screeny, gridspacing=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2177 """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
|
2178 to nearest multiple of GRIDSPACING units.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2179 return getdouble(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2180 self._w, 'canvasy', screeny, gridspacing)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2181 def coords(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2182 """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
|
2183 # XXX Should use _flatten on args |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
2184 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
|
2185 self.tk.splitlist( |
|
66407
cc9c51f9524f
Merged revisions 86697 via svnmerge from
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
54475
diff
changeset
|
2186 self.tk.call((self._w, 'coords') + args))] |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2187 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
|
2188 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2189 args = _flatten(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2190 cnf = args[-1] |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
2191 if isinstance(cnf, (dict, tuple)): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2192 args = args[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2193 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2194 cnf = {} |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2195 return getint(self.tk.call( |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2196 self._w, 'create', itemType, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2197 *(args + self._options(cnf, kw)))) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2198 def create_arc(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2199 """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
|
2200 return self._create('arc', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2201 def create_bitmap(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2202 """Create bitmap with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2203 return self._create('bitmap', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2204 def create_image(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2205 """Create image item with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2206 return self._create('image', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2207 def create_line(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2208 """Create line with coordinates x1,y1,...,xn,yn.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2209 return self._create('line', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2210 def create_oval(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2211 """Create oval with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2212 return self._create('oval', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2213 def create_polygon(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2214 """Create polygon with coordinates x1,y1,...,xn,yn.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2215 return self._create('polygon', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2216 def create_rectangle(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2217 """Create rectangle with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2218 return self._create('rectangle', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2219 def create_text(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2220 """Create text with coordinates x1,y1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2221 return self._create('text', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2222 def create_window(self, *args, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2223 """Create window with coordinates x1,y1,x2,y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2224 return self._create('window', args, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2225 def dchars(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2226 """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
|
2227 several times) from FIRST to LAST character (including).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2228 self.tk.call((self._w, 'dchars') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2229 def delete(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2230 """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
|
2231 self.tk.call((self._w, 'delete') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2232 def dtag(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2233 """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
|
2234 identified by first argument in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2235 self.tk.call((self._w, 'dtag') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2236 def find(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2237 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2238 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2239 self.tk.call((self._w, 'find') + args)) or () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2240 def find_above(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2241 """Return items above TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2242 return self.find('above', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2243 def find_all(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2244 """Return all items.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2245 return self.find('all') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2246 def find_below(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2247 """Return all items below TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2248 return self.find('below', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2249 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
|
2250 """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
|
2251 If several match take the top-most. |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2252 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
|
2253 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
|
2254 return self.find('closest', x, y, halo, start) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2255 def find_enclosed(self, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2256 """Return all items in rectangle defined |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2257 by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2258 return self.find('enclosed', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2259 def find_overlapping(self, x1, y1, x2, y2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2260 """Return all items which overlap the rectangle |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2261 defined by X1,Y1,X2,Y2.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2262 return self.find('overlapping', x1, y1, x2, y2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2263 def find_withtag(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2264 """Return all items with TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2265 return self.find('withtag', tagOrId) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2266 def focus(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2267 """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
|
2268 return self.tk.call((self._w, 'focus') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2269 def gettags(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2270 """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
|
2271 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2272 self.tk.call((self._w, 'gettags') + args)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2273 def icursor(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2274 """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
|
2275 In ARGS TAGORID must be first.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2276 self.tk.call((self._w, 'icursor') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2277 def index(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2278 """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
|
2279 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
|
2280 def insert(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2281 """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
|
2282 be TAGORID POS TEXT.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2283 self.tk.call((self._w, 'insert') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2284 def itemcget(self, tagOrId, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2285 """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
|
2286 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2287 (self._w, 'itemcget') + (tagOrId, '-'+option)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2288 def itemconfigure(self, tagOrId, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2289 """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
|
2290 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2291 The values for resources are specified as keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2292 arguments. To get an overview about |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2293 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
|
2294 """ |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
2295 return self._configure(('itemconfigure', tagOrId), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2296 itemconfig = itemconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2297 # 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
|
2298 # 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
|
2299 # (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
|
2300 # 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
|
2301 def tag_lower(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2302 """Lower an item TAGORID given in ARGS |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2303 (optional below another item).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2304 self.tk.call((self._w, 'lower') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2305 lower = tag_lower |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2306 def move(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2307 """Move an item TAGORID given in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2308 self.tk.call((self._w, 'move') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2309 def postscript(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2310 """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
|
2311 file. Valid options: colormap, colormode, file, fontmap, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2312 height, pageanchor, pageheight, pagewidth, pagex, pagey, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2313 rotate, witdh, x, y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2314 return self.tk.call((self._w, 'postscript') + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2315 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2316 def tag_raise(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2317 """Raise an item TAGORID given in ARGS |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2318 (optional above another item).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2319 self.tk.call((self._w, 'raise') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2320 lift = tkraise = tag_raise |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2321 def scale(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2322 """Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2323 self.tk.call((self._w, 'scale') + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2324 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2325 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2326 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
|
2327 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
|
2328 """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
|
2329 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
|
2330 scan_mark.""" |
|
27211
a494f5a8639f
Fix SF bug # 602259, 3rd parameter for Tkinter.scan_dragto
Neal Norwitz <nnorwitz@gmail.com>
parents:
26428
diff
changeset
|
2331 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
|
2332 def select_adjust(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2333 """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
|
2334 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
|
2335 def select_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2336 """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
|
2337 self.tk.call(self._w, 'select', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2338 def select_from(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2339 """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
|
2340 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
|
2341 def select_item(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2342 """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
|
2343 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
|
2344 def select_to(self, tagOrId, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2345 """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
|
2346 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
|
2347 def type(self, tagOrId): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2348 """Return the type of the item TAGORID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2349 return self.tk.call(self._w, 'type', tagOrId) or None |
| 1664 | 2350 |
| 2351 class Checkbutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2352 """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
|
2353 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2354 """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
|
2355 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2356 Valid resource names: activebackground, activeforeground, anchor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2357 background, bd, bg, bitmap, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2358 disabledforeground, fg, font, foreground, height, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2359 highlightbackground, highlightcolor, highlightthickness, image, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2360 indicatoron, justify, offvalue, onvalue, padx, pady, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2361 selectcolor, selectimage, state, takefocus, text, textvariable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2362 underline, variable, width, wraplength.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2363 Widget.__init__(self, master, 'checkbutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2364 def deselect(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2365 """Put the button in off-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2366 self.tk.call(self._w, 'deselect') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2367 def flash(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2368 """Flash the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2369 self.tk.call(self._w, 'flash') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2370 def invoke(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2371 """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
|
2372 return self.tk.call(self._w, 'invoke') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2373 def select(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2374 """Put the button in on-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2375 self.tk.call(self._w, 'select') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2376 def toggle(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2377 """Toggle the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2378 self.tk.call(self._w, 'toggle') |
| 1664 | 2379 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2380 class Entry(Widget, XView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2381 """Entry widget which allows to display simple text.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2382 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2383 """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
|
2384 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2385 Valid resource names: background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2386 exportselection, fg, font, foreground, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2387 highlightcolor, highlightthickness, insertbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2388 insertborderwidth, insertofftime, insertontime, insertwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2389 invalidcommand, invcmd, justify, relief, selectbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2390 selectborderwidth, selectforeground, show, state, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2391 textvariable, validate, validatecommand, vcmd, width, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2392 xscrollcommand.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2393 Widget.__init__(self, master, 'entry', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2394 def delete(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2395 """Delete text from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2396 self.tk.call(self._w, 'delete', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2397 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2398 """Return the text.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2399 return self.tk.call(self._w, 'get') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2400 def icursor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2401 """Insert cursor at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2402 self.tk.call(self._w, 'icursor', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2403 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2404 """Return position of cursor.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2405 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2406 self._w, 'index', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2407 def insert(self, index, string): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2408 """Insert STRING at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2409 self.tk.call(self._w, 'insert', index, string) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2410 def scan_mark(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2411 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2412 self.tk.call(self._w, 'scan', 'mark', x) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2413 def scan_dragto(self, x): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2414 """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
|
2415 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
|
2416 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2417 self.tk.call(self._w, 'scan', 'dragto', x) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2418 def selection_adjust(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2419 """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
|
2420 self.tk.call(self._w, 'selection', 'adjust', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2421 select_adjust = selection_adjust |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2422 def selection_clear(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2423 """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
|
2424 self.tk.call(self._w, 'selection', 'clear') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2425 select_clear = selection_clear |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2426 def selection_from(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2427 """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
|
2428 self.tk.call(self._w, 'selection', 'from', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2429 select_from = selection_from |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2430 def selection_present(self): |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2431 """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
|
2432 otherwise.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2433 return self.tk.getboolean( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2434 self.tk.call(self._w, 'selection', 'present')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2435 select_present = selection_present |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2436 def selection_range(self, start, end): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2437 """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
|
2438 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
|
2439 select_range = selection_range |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2440 def selection_to(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2441 """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
|
2442 self.tk.call(self._w, 'selection', 'to', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2443 select_to = selection_to |
| 1664 | 2444 |
| 2445 class Frame(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2446 """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
|
2447 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2448 """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
|
2449 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2450 Valid resource names: background, bd, bg, borderwidth, class, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2451 colormap, container, cursor, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2452 highlightcolor, highlightthickness, relief, takefocus, visual, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2453 cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2454 extra = () |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2455 if 'class_' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2456 extra = ('-class', cnf['class_']) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2457 del cnf['class_'] |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
2458 elif 'class' in cnf: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2459 extra = ('-class', cnf['class']) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2460 del cnf['class'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2461 Widget.__init__(self, master, 'frame', cnf, {}, extra) |
| 1664 | 2462 |
| 2463 class Label(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2464 """Label widget which can display text and bitmaps.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2465 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2466 """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
|
2467 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2468 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2469 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2470 activebackground, activeforeground, anchor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2471 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
|
2472 disabledforeground, font, foreground, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2473 highlightbackground, highlightcolor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2474 highlightthickness, image, justify, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2475 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
|
2476 textvariable, underline, wraplength |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2477 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2478 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2479 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2480 height, state, width |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2481 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2482 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2483 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
|
2484 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2485 class Listbox(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2486 """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
|
2487 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2488 """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
|
2489 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2490 Valid resource names: background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2491 exportselection, fg, font, foreground, height, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2492 highlightcolor, highlightthickness, relief, selectbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2493 selectborderwidth, selectforeground, selectmode, setgrid, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2494 width, xscrollcommand, yscrollcommand, listvariable.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2495 Widget.__init__(self, master, 'listbox', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2496 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2497 """Activate item identified by INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2498 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2499 def bbox(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2500 """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
|
2501 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
|
2502 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2503 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
|
2504 def curselection(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2505 """Return list of indices of currently selected item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2506 # XXX Ought to apply self._getints()... |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2507 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2508 self._w, 'curselection')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2509 def delete(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2510 """Delete items from FIRST to LAST (not included).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2511 self.tk.call(self._w, 'delete', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2512 def get(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2513 """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
|
2514 if last: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2515 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2516 self._w, 'get', first, last)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2517 else: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2518 return self.tk.call(self._w, 'get', first) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2519 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2520 """Return index of item identified with INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2521 i = self.tk.call(self._w, 'index', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2522 if i == 'none': return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2523 return getint(i) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2524 def insert(self, index, *elements): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2525 """Insert ELEMENTS at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2526 self.tk.call((self._w, 'insert', index) + elements) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2527 def nearest(self, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2528 """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
|
2529 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2530 self._w, 'nearest', y)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2531 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2532 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2533 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
|
2534 def scan_dragto(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2535 """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
|
2536 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
|
2537 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2538 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
|
2539 def see(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2540 """Scroll such that INDEX is visible.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2541 self.tk.call(self._w, 'see', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2542 def selection_anchor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2543 """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
|
2544 self.tk.call(self._w, 'selection', 'anchor', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2545 select_anchor = selection_anchor |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2546 def selection_clear(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2547 """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
|
2548 self.tk.call(self._w, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2549 'selection', 'clear', first, last) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2550 select_clear = selection_clear |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2551 def selection_includes(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2552 """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
|
2553 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2554 self._w, 'selection', 'includes', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2555 select_includes = selection_includes |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2556 def selection_set(self, first, last=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2557 """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
|
2558 changing the currently selected elements.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2559 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
|
2560 select_set = selection_set |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2561 def size(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2562 """Return the number of elements in the listbox.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2563 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
|
2564 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
|
2565 """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
|
2566 return self.tk.call( |
|
8541878cf2e1
class Listbox: add itemcget, to satisfy SF patch #457713.
Guido van Rossum <guido@python.org>
parents:
19638
diff
changeset
|
2567 (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
|
2568 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
|
2569 """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
|
2570 |
|
40feaedb7867
Add Listbox.itemconfig[ure] call. (A "recent" addition to Tk -- 8.0
Guido van Rossum <guido@python.org>
parents:
19439
diff
changeset
|
2571 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
|
2572 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
|
2573 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
|
2574 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
|
2575 selectbackground, selectforeground.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
2576 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
|
2577 itemconfig = itemconfigure |
| 1664 | 2578 |
| 2579 class Menu(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2580 """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
|
2581 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2582 """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
|
2583 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2584 Valid resource names: activebackground, activeborderwidth, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2585 activeforeground, background, bd, bg, borderwidth, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2586 disabledforeground, fg, font, foreground, postcommand, relief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2587 selectcolor, takefocus, tearoff, tearoffcommand, title, type.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2588 Widget.__init__(self, master, 'menu', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2589 def tk_bindForTraversal(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2590 pass # obsolete since Tk 4.0 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2591 def tk_mbPost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2592 self.tk.call('tk_mbPost', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2593 def tk_mbUnpost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2594 self.tk.call('tk_mbUnpost') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2595 def tk_traverseToMenu(self, char): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2596 self.tk.call('tk_traverseToMenu', self._w, char) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2597 def tk_traverseWithinMenu(self, char): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2598 self.tk.call('tk_traverseWithinMenu', self._w, char) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2599 def tk_getMenuButtons(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2600 return self.tk.call('tk_getMenuButtons', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2601 def tk_nextMenu(self, count): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2602 self.tk.call('tk_nextMenu', count) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2603 def tk_nextMenuEntry(self, count): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2604 self.tk.call('tk_nextMenuEntry', count) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2605 def tk_invokeMenu(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2606 self.tk.call('tk_invokeMenu', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2607 def tk_firstMenu(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2608 self.tk.call('tk_firstMenu', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2609 def tk_mbButtonDown(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2610 self.tk.call('tk_mbButtonDown', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2611 def tk_popup(self, x, y, entry=""): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2612 """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
|
2613 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
|
2614 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2615 """Activate entry at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2616 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2617 def add(self, itemType, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2618 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2619 self.tk.call((self._w, 'add', itemType) + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2620 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2621 def add_cascade(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2622 """Add hierarchical menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2623 self.add('cascade', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2624 def add_checkbutton(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2625 """Add checkbutton menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2626 self.add('checkbutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2627 def add_command(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2628 """Add command menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2629 self.add('command', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2630 def add_radiobutton(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2631 """Addd radio menu item.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2632 self.add('radiobutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2633 def add_separator(self, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2634 """Add separator.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2635 self.add('separator', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2636 def insert(self, index, itemType, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2637 """Internal function.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2638 self.tk.call((self._w, 'insert', index, itemType) + |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2639 self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2640 def insert_cascade(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2641 """Add hierarchical menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2642 self.insert(index, 'cascade', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2643 def insert_checkbutton(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2644 """Add checkbutton menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2645 self.insert(index, 'checkbutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2646 def insert_command(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2647 """Add command menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2648 self.insert(index, 'command', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2649 def insert_radiobutton(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2650 """Addd radio menu item at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2651 self.insert(index, 'radiobutton', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2652 def insert_separator(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2653 """Add separator at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2654 self.insert(index, 'separator', cnf or kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2655 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
|
2656 """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
|
2657 if index2 is None: |
|
054dc111b1d9
Merged revisions 65622 via svnmerge from
Robert Schuppenies <okkotonushi@googlemail.com>
parents:
48619
diff
changeset
|
2658 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
|
2659 |
|
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
|
2660 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
|
2661 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
|
2662 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
|
2663 |
|
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
|
2664 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
|
2665 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
|
2666 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
|
2667 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
|
2668 self.deletecommand(c) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2669 self.tk.call(self._w, 'delete', index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2670 def entrycget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2671 """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
|
2672 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
|
2673 def entryconfigure(self, index, cnf=None, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2674 """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
|
2675 return self._configure(('entryconfigure', index), cnf, kw) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2676 entryconfig = entryconfigure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2677 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2678 """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
|
2679 i = self.tk.call(self._w, 'index', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2680 if i == 'none': return None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2681 return getint(i) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2682 def invoke(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2683 """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
|
2684 the associated command.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2685 return self.tk.call(self._w, 'invoke', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2686 def post(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2687 """Display a menu at position X,Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2688 self.tk.call(self._w, 'post', x, y) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2689 def type(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2690 """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
|
2691 return self.tk.call(self._w, 'type', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2692 def unpost(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2693 """Unmap a menu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2694 self.tk.call(self._w, 'unpost') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2695 def yposition(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2696 """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
|
2697 return getint(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2698 self._w, 'yposition', index)) |
| 1664 | 2699 |
| 2700 class Menubutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2701 """Menubutton widget, obsolete since Tk8.0.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2702 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2703 Widget.__init__(self, master, 'menubutton', cnf, kw) |
| 1664 | 2704 |
| 2705 class Message(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2706 """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
|
2707 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2708 Widget.__init__(self, master, 'message', cnf, kw) |
| 1664 | 2709 |
| 2710 class Radiobutton(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2711 """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
|
2712 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2713 """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
|
2714 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2715 Valid resource names: activebackground, activeforeground, anchor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2716 background, bd, bg, bitmap, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2717 disabledforeground, fg, font, foreground, height, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2718 highlightbackground, highlightcolor, highlightthickness, image, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2719 indicatoron, justify, padx, pady, relief, selectcolor, selectimage, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2720 state, takefocus, text, textvariable, underline, value, variable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2721 width, wraplength.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2722 Widget.__init__(self, master, 'radiobutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2723 def deselect(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2724 """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
|
2725 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2726 self.tk.call(self._w, 'deselect') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2727 def flash(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2728 """Flash the button.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2729 self.tk.call(self._w, 'flash') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2730 def invoke(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2731 """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
|
2732 return self.tk.call(self._w, 'invoke') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2733 def select(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2734 """Put the button in on-state.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2735 self.tk.call(self._w, 'select') |
| 1664 | 2736 |
| 2737 class Scale(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2738 """Scale widget which can display a numerical scale.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2739 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2740 """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
|
2741 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2742 Valid resource names: activebackground, background, bigincrement, bd, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2743 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
|
2744 highlightbackground, highlightcolor, highlightthickness, label, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2745 length, orient, relief, repeatdelay, repeatinterval, resolution, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2746 showvalue, sliderlength, sliderrelief, state, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2747 tickinterval, to, troughcolor, variable, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2748 Widget.__init__(self, master, 'scale', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2749 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2750 """Get the current value as integer or float.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2751 value = self.tk.call(self._w, 'get') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2752 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2753 return getint(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2754 except ValueError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2755 return getdouble(value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2756 def set(self, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2757 """Set the value to VALUE.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2758 self.tk.call(self._w, 'set', value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2759 def coords(self, value=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2760 """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
|
2761 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
|
2762 given.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2763 |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2764 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
|
2765 def identify(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2766 """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
|
2767 "though1" and "though2".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2768 return self.tk.call(self._w, 'identify', x, y) |
| 1664 | 2769 |
| 2770 class Scrollbar(Widget): | |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2771 """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
|
2772 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2773 """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
|
2774 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2775 Valid resource names: activebackground, activerelief, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2776 background, bd, bg, borderwidth, command, cursor, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2777 elementborderwidth, highlightbackground, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2778 highlightcolor, highlightthickness, jump, orient, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2779 relief, repeatdelay, repeatinterval, takefocus, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2780 troughcolor, width.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2781 Widget.__init__(self, master, 'scrollbar', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2782 def activate(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2783 """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
|
2784 INDEX can be "arrow1","slider" or "arrow2".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2785 self.tk.call(self._w, 'activate', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2786 def delta(self, deltax, deltay): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2787 """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
|
2788 would be moved by DELTAX or DELTAY pixels.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2789 return getdouble( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2790 self.tk.call(self._w, 'delta', deltax, deltay)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2791 def fraction(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2792 """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
|
2793 position of X,Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2794 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
|
2795 def identify(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2796 """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
|
2797 "arrow1","slider","arrow2" or "".""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2798 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
|
2799 def get(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2800 """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
|
2801 of the slider position.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2802 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
|
2803 def set(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2804 """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
|
2805 lower ends as value between 0 and 1).""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2806 self.tk.call((self._w, 'set') + args) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2807 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2808 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2809 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
2810 class Text(Widget, XView, YView): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2811 """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
|
2812 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2813 """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
|
2814 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2815 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2816 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2817 background, borderwidth, cursor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2818 exportselection, font, foreground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2819 highlightbackground, highlightcolor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2820 highlightthickness, insertbackground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2821 insertborderwidth, insertofftime, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2822 insertontime, insertwidth, padx, pady, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2823 relief, selectbackground, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2824 selectborderwidth, selectforeground, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2825 setgrid, takefocus, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2826 xscrollcommand, yscrollcommand, |
|
13133
15651490af34
Nils Fischbeck: added doc strings to everything. Martin von Loewis
Guido van Rossum <guido@python.org>
parents:
12953
diff
changeset
|
2827 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2828 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2829 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2830 autoseparators, height, maxundo, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2831 spacing1, spacing2, spacing3, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2832 state, tabs, undo, width, wrap, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2833 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2834 """ |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2835 Widget.__init__(self, master, 'text', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2836 def bbox(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2837 """Return a tuple of (x,y,width,height) which gives the bounding |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2838 box of the visible part of the character at the index in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2839 return self._getints( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2840 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
|
2841 def tk_textSelectTo(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2842 self.tk.call('tk_textSelectTo', self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2843 def tk_textBackspace(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2844 self.tk.call('tk_textBackspace', self._w) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2845 def tk_textIndexCloser(self, a, b, c): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2846 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
|
2847 def tk_textResetAnchor(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2848 self.tk.call('tk_textResetAnchor', self._w, index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2849 def compare(self, index1, op, index2): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2850 """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
|
2851 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
|
2852 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2853 self._w, 'compare', index1, op, index2)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2854 def debug(self, boolean=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2855 """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
|
2856 widget according to BOOLEAN.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2857 return self.tk.getboolean(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2858 self._w, 'debug', boolean)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2859 def delete(self, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2860 """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
|
2861 self.tk.call(self._w, 'delete', index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2862 def dlineinfo(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2863 """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
|
2864 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
|
2865 the character at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2866 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
|
2867 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
|
2868 """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
|
2869 |
|
23241
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2870 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
|
2871 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
|
2872 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
|
2873 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
|
2874 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
|
2875 |
|
23241
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2876 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
|
2877 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
|
2878 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
|
2879 args = [] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2880 func_name = None |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2881 result = None |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2882 if not command: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2883 # 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
|
2884 # 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
|
2885 # 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
|
2886 # 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
|
2887 result = [] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2888 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
|
2889 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
|
2890 command = append_triple |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2891 try: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2892 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
|
2893 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
|
2894 args += ["-command", command] |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2895 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
|
2896 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
|
2897 args.append(index1) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2898 if index2: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2899 args.append(index2) |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2900 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
|
2901 return result |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2902 finally: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2903 if func_name: |
|
30458a11b5e0
SF patch 546244 by John Williams: add Text.dump() method.
Guido van Rossum <guido@python.org>
parents:
22608
diff
changeset
|
2904 self.deletecommand(func_name) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
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 ## new in tk8.4 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2907 def edit(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2908 """Internal method |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2909 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2910 This method controls the undo mechanism and |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2911 the modified flag. The exact behavior of the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2912 command depends on the option argument that |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2913 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
|
2914 of the command are currently supported: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2915 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2916 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
|
2917 and edit_undo |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2918 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2919 """ |
|
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
|
2920 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
|
2921 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2922 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
|
2923 """Get or Set the modified flag |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2924 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2925 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
|
2926 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
|
2927 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
|
2928 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
|
2929 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
|
2930 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2931 return self.edit("modified", arg) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2932 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2933 def edit_redo(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2934 """Redo the last undone edit |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2935 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2936 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
|
2937 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
|
2938 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
|
2939 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
|
2940 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2941 return self.edit("redo") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2942 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2943 def edit_reset(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2944 """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
|
2945 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2946 return self.edit("reset") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2947 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2948 def edit_separator(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2949 """Inserts a separator (boundary) on the undo stack. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2950 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2951 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
|
2952 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2953 return self.edit("separator") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2954 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2955 def edit_undo(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2956 """Undoes the last edit action |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2957 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2958 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
|
2959 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
|
2960 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
|
2961 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
|
2962 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
|
2963 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
2964 return self.edit("undo") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2965 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2966 def get(self, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2967 """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
|
2968 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
|
2969 # (Image commands are new in 8.0) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2970 def image_cget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2971 """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
|
2972 if option[:1] != "-": |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2973 option = "-" + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2974 if option[-1:] == "_": |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2975 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2976 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
|
2977 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
|
2978 """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
|
2979 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
|
2980 def image_create(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2981 """Create an embedded image at INDEX.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2982 return self.tk.call( |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2983 self._w, "image", "create", index, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
2984 *self._options(cnf, kw)) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2985 def image_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2986 """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
|
2987 return self.tk.call(self._w, "image", "names") |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2988 def index(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2989 """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
|
2990 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
|
2991 def insert(self, index, chars, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2992 """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
|
2993 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
|
2994 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
|
2995 def mark_gravity(self, markName, direction=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2996 """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
|
2997 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
|
2998 return self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
2999 (self._w, 'mark', 'gravity', markName, direction)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3000 def mark_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3001 """Return all mark names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3002 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3003 self._w, 'mark', 'names')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3004 def mark_set(self, markName, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3005 """Set mark MARKNAME before the character at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3006 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
|
3007 def mark_unset(self, *markNames): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3008 """Delete all marks in MARKNAMES.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3009 self.tk.call((self._w, 'mark', 'unset') + markNames) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3010 def mark_next(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3011 """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
|
3012 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
|
3013 def mark_previous(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3014 """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
|
3015 return self.tk.call(self._w, 'mark', 'previous', index) or None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3016 def scan_mark(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3017 """Remember the current X, Y coordinates.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3018 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
|
3019 def scan_dragto(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3020 """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
|
3021 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
|
3022 scan_mark.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3023 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
|
3024 def search(self, pattern, index, stopindex=None, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3025 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
|
3026 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
|
3027 """Search PATTERN beginning from INDEX until STOPINDEX. |
|
51484
663ce74d5175
Merged revisions 69463 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
50532
diff
changeset
|
3028 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
|
3029 empty string.""" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3030 args = [self._w, 'search'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3031 if forwards: args.append('-forwards') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3032 if backwards: args.append('-backwards') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3033 if exact: args.append('-exact') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3034 if regexp: args.append('-regexp') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3035 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
|
3036 if elide: args.append('-elide') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3037 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
|
3038 if pattern and pattern[0] == '-': args.append('--') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3039 args.append(pattern) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3040 args.append(index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3041 if stopindex: args.append(stopindex) |
|
52057
03c80e0742c3
Merged revisions 70218-70219 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
51776
diff
changeset
|
3042 return str(self.tk.call(tuple(args))) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3043 def see(self, index): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3044 """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
|
3045 self.tk.call(self._w, 'see', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3046 def tag_add(self, tagName, index1, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3047 """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
|
3048 Additional pairs of indices may follow in ARGS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3049 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3050 (self._w, 'tag', 'add', tagName, index1) + args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3051 def tag_unbind(self, tagName, sequence, funcid=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3052 """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
|
3053 function identified with FUNCID.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3054 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
|
3055 if funcid: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3056 self.deletecommand(funcid) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3057 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
|
3058 """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
|
3059 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3060 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
|
3061 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
|
3062 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
|
3063 return self._bind((self._w, 'tag', 'bind', tagName), |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3064 sequence, func, add) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3065 def tag_cget(self, tagName, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3066 """Return the value of OPTION for tag TAGNAME.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3067 if option[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3068 option = '-' + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3069 if option[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3070 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3071 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
|
3072 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
|
3073 """Configure a tag TAGNAME.""" |
|
25695
50013d1c6a43
Patch #612602: Streamline configure methods.
Martin v. Löwis <martin@v.loewis.de>
parents:
24357
diff
changeset
|
3074 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
|
3075 tag_config = tag_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3076 def tag_delete(self, *tagNames): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3077 """Delete all tags in TAGNAMES.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3078 self.tk.call((self._w, 'tag', 'delete') + tagNames) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3079 def tag_lower(self, tagName, belowThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3080 """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
|
3081 than the priority of BELOWTHIS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3082 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
|
3083 def tag_names(self, index=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3084 """Return a list of all tag names.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3085 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3086 self.tk.call(self._w, 'tag', 'names', index)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3087 def tag_nextrange(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3088 """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
|
3089 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
|
3090 The text is searched forward from INDEX1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3091 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3092 self._w, 'tag', 'nextrange', tagName, index1, index2)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3093 def tag_prevrange(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3094 """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
|
3095 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
|
3096 The text is searched backwards from INDEX1.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3097 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3098 self._w, 'tag', 'prevrange', tagName, index1, index2)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3099 def tag_raise(self, tagName, aboveThis=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3100 """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
|
3101 than the priority of ABOVETHIS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3102 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3103 self._w, 'tag', 'raise', tagName, aboveThis) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3104 def tag_ranges(self, tagName): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3105 """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
|
3106 return self.tk.splitlist(self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3107 self._w, 'tag', 'ranges', tagName)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3108 def tag_remove(self, tagName, index1, index2=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3109 """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
|
3110 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3111 self._w, 'tag', 'remove', tagName, index1, index2) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3112 def window_cget(self, index, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3113 """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
|
3114 if option[:1] != '-': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3115 option = '-' + option |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3116 if option[-1:] == '_': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3117 option = option[:-1] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3118 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
|
3119 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
|
3120 """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
|
3121 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
|
3122 window_config = window_configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3123 def window_create(self, index, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3124 """Create a window at INDEX.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3125 self.tk.call( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3126 (self._w, 'window', 'create', index) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3127 + self._options(cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3128 def window_names(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3129 """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
|
3130 return self.tk.splitlist( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3131 self.tk.call(self._w, 'window', 'names')) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3132 def yview_pickplace(self, *what): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3133 """Obsolete function, use see.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3134 self.tk.call((self._w, 'yview', '-pickplace') + what) |
| 1664 | 3135 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3136 |
|
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
|
3137 class _setit: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3138 """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
|
3139 def __init__(self, var, value, callback=None): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3140 self.__value = value |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3141 self.__var = var |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3142 self.__callback = callback |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3143 def __call__(self, *args): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3144 self.__var.set(self.__value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3145 if self.__callback: |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3146 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
|
3147 |
|
938be7a3106f
(Fred Drake:) Re-wrote the OptionMenu class to allow access to a real
Guido van Rossum <guido@python.org>
parents:
4358
diff
changeset
|
3148 class OptionMenu(Menubutton): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3149 """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
|
3150 def __init__(self, master, variable, value, *values, **kwargs): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3151 """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
|
3152 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
|
3153 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
|
3154 keyword argument command.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3155 kw = {"borderwidth": 2, "textvariable": variable, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3156 "indicatoron": 1, "relief": RAISED, "anchor": "c", |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3157 "highlightthickness": 2} |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3158 Widget.__init__(self, master, "menubutton", kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3159 self.widgetName = 'tk_optionMenu' |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3160 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
|
3161 self.menuname = menu._w |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3162 # 'command' is the only supported keyword |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3163 callback = kwargs.get('command') |
|
39592
0f135affabf2
Couple more has_keys() going...
Guido van Rossum <guido@python.org>
parents:
39442
diff
changeset
|
3164 if 'command' in kwargs: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3165 del kwargs['command'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3166 if kwargs: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
3167 raise TclError('unknown option -'+kwargs.keys()[0]) |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3168 menu.add_command(label=value, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3169 command=_setit(variable, value, callback)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3170 for v in values: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3171 menu.add_command(label=v, |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3172 command=_setit(variable, v, callback)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3173 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
|
3174 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3175 def __getitem__(self, name): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3176 if name == 'menu': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3177 return self.__menu |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3178 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
|
3179 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3180 def destroy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3181 """Destroy this widget and the associated menu.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3182 Menubutton.destroy(self) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3183 self.__menu = None |
|
3067
6ec820db2ffa
added OptionMenu class (tk_optionMenu interface)
Guido van Rossum <guido@python.org>
parents:
2968
diff
changeset
|
3184 |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3185 class Image: |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3186 """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
|
3187 _last_id = 0 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3188 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
|
3189 self.name = None |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3190 if not master: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3191 master = _default_root |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3192 if not master: |
|
43020
907a45df1295
Raise statement normalization in Lib/.
Collin Winter <collinw@gmail.com>
parents:
42552
diff
changeset
|
3193 raise RuntimeError('Too early to create image') |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3194 self.tk = master.tk |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3195 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
|
3196 Image._last_id += 1 |
|
31515
71a294bd7950
Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents:
29729
diff
changeset
|
3197 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
|
3198 # 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
|
3199 # 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
|
3200 if name[0] == '-': name = '_' + name[1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3201 if kw and cnf: cnf = _cnfmerge((cnf, kw)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3202 elif kw: cnf = kw |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3203 options = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3204 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
|
3205 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3206 v = self._register(v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3207 options = options + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3208 self.tk.call(('image', 'create', imgtype, name,) + options) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3209 self.name = name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3210 def __str__(self): return self.name |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3211 def __del__(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3212 if self.name: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3213 try: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3214 self.tk.call('image', 'delete', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3215 except TclError: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3216 # May happen if the root was destroyed |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3217 pass |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3218 def __setitem__(self, key, value): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3219 self.tk.call(self.name, 'configure', '-'+key, value) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3220 def __getitem__(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3221 return self.tk.call(self.name, 'configure', '-'+key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3222 def configure(self, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3223 """Configure the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3224 res = () |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3225 for k, v in _cnfmerge(kw).items(): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3226 if v is not None: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3227 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
|
3228 if callable(v): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3229 v = self._register(v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3230 res = res + ('-'+k, v) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3231 self.tk.call((self.name, 'config') + res) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3232 config = configure |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3233 def height(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3234 """Return the height of the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3235 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3236 self.tk.call('image', 'height', self.name)) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3237 def type(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3238 """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
|
3239 return self.tk.call('image', 'type', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3240 def width(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3241 """Return the width of the image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3242 return getint( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3243 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
|
3244 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3245 class PhotoImage(Image): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3246 """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
|
3247 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
|
3248 """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
|
3249 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3250 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
|
3251 width.""" |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3252 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
|
3253 def blank(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3254 """Display a transparent image.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3255 self.tk.call(self.name, 'blank') |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3256 def cget(self, option): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3257 """Return the value of OPTION.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3258 return self.tk.call(self.name, 'cget', '-' + option) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3259 # XXX config |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3260 def __getitem__(self, key): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3261 return self.tk.call(self.name, 'cget', '-' + key) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3262 # XXX copy -from, -to, ...? |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3263 def copy(self): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3264 """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
|
3265 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3266 self.tk.call(destImage, 'copy', self.name) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3267 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3268 def zoom(self,x,y=''): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3269 """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
|
3270 but zoom it with X and Y.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3271 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3272 if y=='': y=x |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3273 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
|
3274 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3275 def subsample(self,x,y=''): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3276 """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
|
3277 but use only every Xth or Yth pixel.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3278 destImage = PhotoImage() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3279 if y=='': y=x |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3280 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
|
3281 return destImage |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3282 def get(self, x, y): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3283 """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
|
3284 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
|
3285 def put(self, data, to=None): |
|
51776
d06a3ebf306f
Merged revisions 69846 via svnmerge from
Mark Dickinson <dickinsm@gmail.com>
parents:
51484
diff
changeset
|
3286 """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
|
3287 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
|
3288 args = (self.name, 'put', data) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3289 if to: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3290 if to[0] == '-to': |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3291 to = to[1:] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3292 args = args + ('-to',) + tuple(to) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3293 self.tk.call(args) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3294 # XXX read |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3295 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
|
3296 """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
|
3297 position FROM_COORDS.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3298 args = (self.name, 'write', filename) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3299 if format: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3300 args = args + ('-format', format) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3301 if from_coords: |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3302 args = args + ('-from',) + tuple(from_coords) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3303 self.tk.call(args) |
|
2884
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3304 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3305 class BitmapImage(Image): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3306 """Widget which can display a bitmap.""" |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3307 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
|
3308 """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
|
3309 |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3310 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
|
3311 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
|
3312 |
|
e006ed88b4aa
keyword arguments; redid Photo image class; other goodies
Guido van Rossum <guido@python.org>
parents:
2830
diff
changeset
|
3313 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
|
3314 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
|
3315 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3316 |
|
55642
e4a83e91521a
Merged revisions 74446-74449 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
54475
diff
changeset
|
3317 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
|
3318 """spinbox widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3319 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
|
3320 """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
|
3321 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3322 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3323 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3324 activebackground, background, borderwidth, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3325 cursor, exportselection, font, foreground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3326 highlightbackground, highlightcolor, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3327 highlightthickness, insertbackground, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3328 insertborderwidth, insertofftime, |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3329 insertontime, insertwidth, justify, relief, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3330 repeatdelay, repeatinterval, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3331 selectbackground, selectborderwidth |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3332 selectforeground, takefocus, textvariable |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3333 xscrollcommand. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3334 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3335 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3336 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3337 buttonbackground, buttoncursor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3338 buttondownrelief, buttonuprelief, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3339 command, disabledbackground, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3340 disabledforeground, format, from, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3341 invalidcommand, increment, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3342 readonlybackground, state, to, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3343 validate, validatecommand values, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3344 width, wrap, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3345 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3346 Widget.__init__(self, master, 'spinbox', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3347 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3348 def bbox(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3349 """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
|
3350 rectangle which encloses the character given by index. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3351 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3352 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
|
3353 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
|
3354 area covered by the character (in pixels relative |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3355 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
|
3356 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
|
3357 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
|
3358 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
|
3359 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3360 return self.tk.call(self._w, 'bbox', index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3361 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3362 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
|
3363 """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
|
3364 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3365 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
|
3366 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
|
3367 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
|
3368 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
|
3369 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
|
3370 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3371 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
|
3372 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3373 def get(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3374 """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
|
3375 return self.tk.call(self._w, 'get') |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3376 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3377 def icursor(self, index): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3378 """Alter the position of the insertion cursor. |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3379 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3380 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
|
3381 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
|
3382 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3383 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
|
3384 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3385 def identify(self, x, y): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3386 """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
|
3387 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3388 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
|
3389 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3390 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
|
3391 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3392 def index(self, index): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3393 """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
|
3394 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3395 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
|
3396 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3397 def insert(self, index, s): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3398 """Insert string s at index |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3399 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3400 Returns an empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3401 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3402 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
|
3403 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3404 def invoke(self, element): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3405 """Causes the specified element to be invoked |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3406 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3407 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
|
3408 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
|
3409 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3410 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
|
3411 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3412 def scan(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3413 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3414 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3415 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
|
3416 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3417 def scan_mark(self, x): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3418 """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
|
3419 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3420 used in conjunction with later scan dragto commands. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3421 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
|
3422 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
|
3423 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3424 return self.scan("mark", x) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3425 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3426 def scan_dragto(self, x): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3427 """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
|
3428 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
|
3429 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3430 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
|
3431 difference in x-coordinates. This command is typically |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3432 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
|
3433 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
|
3434 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
|
3435 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3436 return self.scan("dragto", x) |
|
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 def selection(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3439 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3440 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3441 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
|
3442 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3443 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
|
3444 """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
|
3445 given by index, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3446 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3447 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
|
3448 (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
|
3449 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
|
3450 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
|
3451 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
|
3452 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
|
3453 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
|
3454 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3455 return self.selection("adjust", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3456 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3457 def selection_clear(self): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3458 """Clear the selection |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3459 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3460 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
|
3461 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
|
3462 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3463 return self.selection("clear") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3464 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3465 def selection_element(self, element=None): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3466 """Sets or gets the currently selected element. |
|
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 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
|
3469 displayed depressed |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3470 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3471 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
|
3472 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3473 ########################################################################### |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3474 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3475 class LabelFrame(Widget): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3476 """labelframe widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3477 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
|
3478 """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
|
3479 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3480 STANDARD OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3481 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3482 borderwidth, cursor, font, foreground, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3483 highlightbackground, highlightcolor, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3484 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
|
3485 takefocus, text |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3486 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3487 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3488 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3489 background, class, colormap, container, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3490 height, labelanchor, labelwidget, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3491 visual, width |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3492 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3493 Widget.__init__(self, master, 'labelframe', cnf, kw) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3494 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3495 ######################################################################## |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3496 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3497 class PanedWindow(Widget): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3498 """panedwindow widget.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3499 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
|
3500 """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
|
3501 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3502 STANDARD OPTIONS |
|
28513
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 background, borderwidth, cursor, height, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3505 orient, relief, width |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3506 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3507 WIDGET-SPECIFIC OPTIONS |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3508 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3509 handlepad, handlesize, opaqueresize, |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3510 sashcursor, sashpad, sashrelief, |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3511 sashwidth, showhandle, |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3512 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3513 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
|
3514 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3515 def add(self, child, **kw): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3516 """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
|
3517 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3518 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
|
3519 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
|
3520 manage the windows. The possible options and values |
|
7b772ed536c7
Merged revisions 73083 via svnmerge from
Guilherme Polo <ggpolo@gmail.com>
parents:
52057
diff
changeset
|
3521 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
|
3522 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3523 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
|
3524 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3525 def remove(self, child): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3526 """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
|
3527 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3528 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
|
3529 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3530 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
|
3531 forget=remove |
|
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 identify(self, x, y): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3534 """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
|
3535 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3536 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
|
3537 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
|
3538 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
|
3539 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
|
3540 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
|
3541 an empty list. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3542 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3543 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
|
3544 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3545 def proxy(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3546 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3547 return self._getints( |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3548 self.tk.call((self._w, 'proxy') + args)) or () |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3549 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3550 def proxy_coord(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3551 """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
|
3552 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3553 return self.proxy("coord") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3554 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3555 def proxy_forget(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3556 """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
|
3557 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3558 return self.proxy("forget") |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3559 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3560 def proxy_place(self, x, y): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3561 """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
|
3562 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3563 return self.proxy("place", x, y) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3564 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3565 def sash(self, *args): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3566 """Internal function.""" |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3567 return self._getints( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3568 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
|
3569 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3570 def sash_coord(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3571 """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
|
3572 |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3573 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
|
3574 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
|
3575 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
|
3576 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
|
3577 difference between the given coordinates and the coordinates |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3578 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
|
3579 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
|
3580 empty string. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3581 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3582 return self.sash("coord", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3583 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3584 def sash_mark(self, index): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3585 """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
|
3586 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3587 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
|
3588 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3589 return self.sash("mark", index) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3590 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3591 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
|
3592 """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
|
3593 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3594 return self.sash("place", index, x, y) |
|
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 def panecget(self, child, option): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3597 """Query a management option for window. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3598 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3599 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
|
3600 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3601 return self.tk.call( |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3602 (self._w, 'panecget') + (child, '-'+option)) |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3603 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3604 def paneconfigure(self, tagOrId, cnf=None, **kw): |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3605 """Query or modify the management options for window. |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3606 |
|
25754
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3607 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
|
3608 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
|
3609 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
|
3610 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
|
3611 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
|
3612 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
|
3613 specified, then the command modifies the given widget |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3614 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
|
3615 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
|
3616 are supported: |
|
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 after window |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3619 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
|
3620 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
|
3621 before window |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3622 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
|
3623 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
|
3624 height size |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3625 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
|
3626 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
|
3627 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
|
3628 specified, then the height requested internally by the |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3629 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
|
3630 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
|
3631 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
|
3632 minsize n |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3633 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
|
3634 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
|
3635 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
|
3636 for horizontal panedwindows, the y dimension for |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3637 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
|
3638 Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3639 padx n |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3640 Specifies a non-negative value indicating how much |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3641 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
|
3642 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
|
3643 accepted by Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3644 pady n |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3645 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
|
3646 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
|
3647 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
|
3648 accepted by Tk_GetPixels. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3649 sticky style |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3650 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
|
3651 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
|
3652 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
|
3653 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
|
3654 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
|
3655 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
|
3656 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
|
3657 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
|
3658 (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
|
3659 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
|
3660 its cavity. |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3661 width size |
|
28513
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3662 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
|
3663 the outer dimension of the window including its |
|
90c77b8af1a4
SF patch #701494: more apply removals
Raymond Hettinger <python@rcn.com>
parents:
28435
diff
changeset
|
3664 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
|
3665 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
|
3666 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
|
3667 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
|
3668 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
|
3669 Tk_GetPixels. |
|
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 """ |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3672 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
|
3673 cnf = {} |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3674 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
|
3675 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
|
3676 'paneconfigure', tagOrId)): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3677 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
|
3678 return cnf |
|
41986
6464cc638faa
Merged revisions 55795-55816 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
41824
diff
changeset
|
3679 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
|
3680 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
|
3681 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
|
3682 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
|
3683 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
|
3684 self._options(cnf, kw)) |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3685 paneconfig = paneconfigure |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3686 |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3687 def panes(self): |
|
75cbec40db7d
Patch #621205: Tkinter updates for tk8.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
25695
diff
changeset
|
3688 """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
|
3689 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
|
3690 |
|
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
|
3691 ###################################################################### |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3692 # 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
|
3693 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3694 class Studbutton(Button): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3695 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3696 Widget.__init__(self, master, 'studbutton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3697 self.bind('<Any-Enter>', self.tkButtonEnter) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3698 self.bind('<Any-Leave>', self.tkButtonLeave) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3699 self.bind('<1>', self.tkButtonDown) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3700 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
|
3701 |
|
bb61816e1dab
Sun Jun 26 02:19:01 1994 Steen Lumholt (lumholt@login.dkuug.dk)
Guido van Rossum <guido@python.org>
parents:
1687
diff
changeset
|
3702 class Tributton(Button): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3703 def __init__(self, master=None, cnf={}, **kw): |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3704 Widget.__init__(self, master, 'tributton', cnf, kw) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3705 self.bind('<Any-Enter>', self.tkButtonEnter) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3706 self.bind('<Any-Leave>', self.tkButtonLeave) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3707 self.bind('<1>', self.tkButtonDown) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3708 self.bind('<ButtonRelease-1>', self.tkButtonUp) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3709 self['fg'] = self['bg'] |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3710 self['activebackground'] = self['bg'] |
|
3551
e8a2a5e4c7b0
Resync with Grail's Tkinter.py.
Guido van Rossum <guido@python.org>
parents:
3246
diff
changeset
|
3711 |
|
4103
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3712 ###################################################################### |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3713 # Test: |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3714 |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3715 def _test(): |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3716 root = Tk() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3717 text = "This is Tcl/Tk version %s" % TclVersion |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3718 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
|
3719 text += "\nThis should be a cedilla: \xe7" |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3720 label = Label(root, text=text) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3721 label.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3722 test = Button(root, text="Click me!", |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3723 command=lambda root=root: root.test.configure( |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3724 text="[%s]" % root.test['text'])) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3725 test.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3726 root.test = test |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3727 quit = Button(root, text="QUIT", command=root.destroy) |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3728 quit.pack() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3729 # 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
|
3730 # up on top on Windows... |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3731 root.iconify() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3732 root.update() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3733 root.deiconify() |
|
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3734 root.mainloop() |
|
4103
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3735 |
|
a5a82666977b
Added a small test program.
Guido van Rossum <guido@python.org>
parents:
3952
diff
changeset
|
3736 if __name__ == '__main__': |
|
13903
0ac919ca8e69
-- untabification (use "diff -b" to verify)
Fredrik Lundh <fredrik@pythonware.com>
parents:
13620
diff
changeset
|
3737 _test() |
