annotate Doc/lib/libstdwin.tex @ 25838:8540887bcec6 2.2

Backport of 2.183: Fix memory leak in add_subclass() found by NealN with valgrind.
author Guido van Rossum <guido@python.org>
date Fri, 18 Oct 2002 13:42:21 +0000
parents 376ee174ecd0
children 523c3d61dbdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2609
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
1 \chapter{Standard Windowing Interface}
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
2
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
3 The modules in this chapter are available only on those systems where
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
4 the STDWIN library is available. STDWIN runs on \UNIX{} under X11 and
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
5 on the Macintosh. See CWI report CS-R8817.
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
6
20580
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
7 \warning{Using STDWIN is not recommended for new
2609
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
8 applications. It has never been ported to Microsoft Windows or
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
9 Windows NT, and for X11 or the Macintosh it lacks important
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
10 functionality --- in particular, it has no tools for the construction
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
11 of dialogs. For most platforms, alternative, native solutions exist
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
12 (though none are currently documented in this manual): Tkinter for
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
13 \UNIX{} under X11, native Xt with Motif or Athena widgets for \UNIX{}
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
14 under X11, Win32 for Windows and Windows NT, and a collection of
20580
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
15 native toolkit interfaces for the Macintosh.}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
17
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
18 \section{\module{stdwin} ---
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 13625
diff changeset
19 Platform-independent Graphical User Interface System}
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
20
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
21 \declaremodule{builtin}{stdwin}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 13625
diff changeset
22 \modulesynopsis{Older graphical user interface system for X11 and Macintosh.}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
23
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 This module defines several new object types and functions that
2609
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2581
diff changeset
26 provide access to the functionality of STDWIN.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
27
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
28 On \UNIX{} running X11, it can only be used if the \envvar{DISPLAY}
11456
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
29 environment variable is set or an explicit
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
30 \programopt{-display} \var{displayname} argument is passed to the
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
31 Python interpreter.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
32
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 Functions have names that usually resemble their C STDWIN counterparts
11456
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
34 with the initial `w' dropped. Points are represented by pairs of
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
35 integers; rectangles by pairs of points. For a complete description
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
36 of STDWIN please refer to the documentation of STDWIN for C
42698f345bd3 Use \programopt in one place.
Fred Drake <fdrake@acm.org>
parents: 10703
diff changeset
37 programmers (aforementioned CWI report).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
38
7877
8e5223680a9d Remove all uses of \sectcode; we can now use logical markup everywhere.
Fred Drake <fdrake@acm.org>
parents: 7863
diff changeset
39 \subsection{Functions Defined in Module \module{stdwin}}
2581
4d28b655b728 added nodename macro calls for new very long section names
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
40 \nodename{STDWIN Functions}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
41
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
42 The following functions are defined in the \module{stdwin} module:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
43
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 \begin{funcdesc}{open}{title}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 Open a new window whose initial title is given by the string argument.
10520
7ee1e3134147 Fixed latex2html weirdness with footnotes.
Fred Drake <fdrake@acm.org>
parents: 9537
diff changeset
46 Return a window object; window object methods are described
7ee1e3134147 Fixed latex2html weirdness with footnotes.
Fred Drake <fdrake@acm.org>
parents: 9537
diff changeset
47 below.\footnote{
7ee1e3134147 Fixed latex2html weirdness with footnotes.
Fred Drake <fdrake@acm.org>
parents: 9537
diff changeset
48 The Python version of STDWIN does not support draw procedures;
7ee1e3134147 Fixed latex2html weirdness with footnotes.
Fred Drake <fdrake@acm.org>
parents: 9537
diff changeset
49 all drawing requests are reported as draw events.}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 \begin{funcdesc}{getevent}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 Wait for and return the next event.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 An event is returned as a triple: the first element is the event
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 type, a small integer; the second element is the window object to which
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 the event applies, or
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 \code{None}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
58 if it applies to no window in particular;
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 the third element is type-dependent.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 Names for event types and command codes are defined in the standard
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
61 module \refmodule{stdwinevents}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
63
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 \begin{funcdesc}{pollevent}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
65 Return the next event, if one is immediately available.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 If no event is available, return \code{()}.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
68
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 \begin{funcdesc}{getactive}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 Return the window that is currently active, or \code{None} if no
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 window is currently active. (This can be emulated by monitoring
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
72 WE_ACTIVATE and WE_DEACTIVATE events.)
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
73 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
74
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
75 \begin{funcdesc}{listfontnames}{pattern}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 Return the list of font names in the system that match the pattern (a
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
77 string). The pattern should normally be \code{'*'}; returns all
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
78 available fonts. If the underlying window system is X11, other
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 patterns follow the standard X11 font selection syntax (as used e.g.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
80 in resource definitions), i.e. the wildcard character \code{'*'}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
81 matches any sequence of characters (including none) and \code{'?'}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
82 matches any single character.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
83 On the Macintosh this function currently returns an empty list.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
85
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
86 \begin{funcdesc}{setdefscrollbars}{hflag, vflag}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 Set the flags controlling whether subsequently opened windows will
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
88 have horizontal and/or vertical scroll bars.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
89 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
90
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
91 \begin{funcdesc}{setdefwinpos}{h, v}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
92 Set the default window position for windows opened subsequently.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
94
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
95 \begin{funcdesc}{setdefwinsize}{width, height}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 Set the default window size for windows opened subsequently.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
98
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 \begin{funcdesc}{getdefscrollbars}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 Return the flags controlling whether subsequently opened windows will
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
101 have horizontal and/or vertical scroll bars.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
103
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 \begin{funcdesc}{getdefwinpos}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 Return the default window position for windows opened subsequently.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
106 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
107
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
108 \begin{funcdesc}{getdefwinsize}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
109 Return the default window size for windows opened subsequently.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
110 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
111
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
112 \begin{funcdesc}{getscrsize}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
113 Return the screen size in pixels.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
114 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
115
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
116 \begin{funcdesc}{getscrmm}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
117 Return the screen size in millimeters.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
118 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
119
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
120 \begin{funcdesc}{fetchcolor}{colorname}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
121 Return the pixel value corresponding to the given color name.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
122 Return the default foreground color for unknown color names.
1767
907605320a5f Lots of small corrections by Andrew Kuchling (plus all new rotor docs)
Guido van Rossum <guido@python.org>
parents: 1471
diff changeset
123 Hint: the following code tests whether you are on a machine that
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
124 supports more than two colors:
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
125 \begin{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
126 if stdwin.fetchcolor('black') <> \
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
127 stdwin.fetchcolor('red') <> \
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
128 stdwin.fetchcolor('white'):
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
129 print 'color machine'
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
130 else:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
131 print 'monochrome machine'
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
132 \end{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
133 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
134
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
135 \begin{funcdesc}{setfgcolor}{pixel}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
136 Set the default foreground color.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
137 This will become the default foreground color of windows opened
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
138 subsequently, including dialogs.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
139 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
140
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
141 \begin{funcdesc}{setbgcolor}{pixel}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
142 Set the default background color.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
143 This will become the default background color of windows opened
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
144 subsequently, including dialogs.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
145 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
146
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
147 \begin{funcdesc}{getfgcolor}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
148 Return the pixel value of the current default foreground color.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
149 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
150
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
151 \begin{funcdesc}{getbgcolor}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
152 Return the pixel value of the current default background color.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
153 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
154
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
155 \begin{funcdesc}{setfont}{fontname}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
156 Set the current default font.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 This will become the default font for windows opened subsequently,
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
158 and is also used by the text measuring functions \function{textwidth()},
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
159 \function{textbreak()}, \function{lineheight()} and
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
160 \function{baseline()} below. This accepts two more optional
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
161 parameters, size and style: Size is the font size (in `points').
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
162 Style is a single character specifying the style, as follows:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
163 \code{'b'} = bold,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
164 \code{'i'} = italic,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
165 \code{'o'} = bold + italic,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
166 \code{'u'} = underline;
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
167 default style is roman.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
168 Size and style are ignored under X11 but used on the Macintosh.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
169 (Sorry for all this complexity --- a more uniform interface is being designed.)
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
170 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
171
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
172 \begin{funcdesc}{menucreate}{title}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 Create a menu object referring to a global menu (a menu that appears in
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
174 all windows).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
175 Methods of menu objects are described below.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
176 Note: normally, menus are created locally; see the window method
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
177 \method{menucreate()} below.
20580
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
178 \warning{The menu only appears in a window as long as the object
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
179 returned by this call exists.}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
180 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
181
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
182 \begin{funcdesc}{newbitmap}{width, height}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
183 Create a new bitmap object of the given dimensions.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
184 Methods of bitmap objects are described below.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
185 Not available on the Macintosh.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
186 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
187
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
188 \begin{funcdesc}{fleep}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
189 Cause a beep or bell (or perhaps a `visual bell' or flash, hence the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
190 name).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
191 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
192
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
193 \begin{funcdesc}{message}{string}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
194 Display a dialog box containing the string.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
195 The user must click OK before the function returns.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
196 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
197
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
198 \begin{funcdesc}{askync}{prompt, default}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
199 Display a dialog that prompts the user to answer a question with yes or
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
200 no. Return 0 for no, 1 for yes. If the user hits the Return key, the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
201 default (which must be 0 or 1) is returned. If the user cancels the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
202 dialog, \exception{KeyboardInterrupt} is raised.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
203 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
204
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
205 \begin{funcdesc}{askstr}{prompt, default}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
206 Display a dialog that prompts the user for a string.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
207 If the user hits the Return key, the default string is returned.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
208 If the user cancels the dialog, \exception{KeyboardInterrupt} is
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
209 raised.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
210 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
211
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
212 \begin{funcdesc}{askfile}{prompt, default, new}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
213 Ask the user to specify a filename. If \var{new} is zero it must be
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
214 an existing file; otherwise, it must be a new file. If the user
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
215 cancels the dialog, \exception{KeyboardInterrupt} is raised.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
216 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
217
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
218 \begin{funcdesc}{setcutbuffer}{i, string}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
219 Store the string in the system's cut buffer number \var{i}, where it
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
220 can be found (for pasting) by other applications. On X11, there are 8
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
221 cut buffers (numbered 0..7). Cut buffer number 0 is the `clipboard'
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
222 on the Macintosh.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
223 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
224
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
225 \begin{funcdesc}{getcutbuffer}{i}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
226 Return the contents of the system's cut buffer number \var{i}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
227 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
228
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
229 \begin{funcdesc}{rotatecutbuffers}{n}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
230 On X11, rotate the 8 cut buffers by \var{n}. Ignored on the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
231 Macintosh.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
232 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
233
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
234 \begin{funcdesc}{getselection}{i}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
235 Return X11 selection number \var{i.} Selections are not cut buffers.
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
236 Selection numbers are defined in module \refmodule{stdwinevents}.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
237 Selection \constant{WS_PRIMARY} is the \dfn{primary} selection (used
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
238 by \program{xterm}, for instance); selection \constant{WS_SECONDARY}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
239 is the \dfn{secondary} selection; selection \constant{WS_CLIPBOARD} is
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
240 the \dfn{clipboard} selection (used by \program{xclipboard}). On the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
241 Macintosh, this always returns an empty string.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
242 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
243
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
244 \begin{funcdesc}{resetselection}{i}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
245 Reset selection number \var{i}, if this process owns it. (See window
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
246 method \method{setselection()}).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
247 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
248
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
249 \begin{funcdesc}{baseline}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
250 Return the baseline of the current font (defined by STDWIN as the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
251 vertical distance between the baseline and the top of the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
252 characters).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
253 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
254
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
255 \begin{funcdesc}{lineheight}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
256 Return the total line height of the current font.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
257 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
258
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
259 \begin{funcdesc}{textbreak}{str, width}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
260 Return the number of characters of the string that fit into a space of
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
261 \var{width}
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 11456
diff changeset
262 bits wide when drawn in the current font.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
263 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
264
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
265 \begin{funcdesc}{textwidth}{str}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
266 Return the width in bits of the string when drawn in the current font.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
267 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
268
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
269 \begin{funcdesc}{connectionnumber}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
270 \funcline{fileno}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
271 (X11 under \UNIX{} only) Return the ``connection number'' used by the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
272 underlying X11 implementation. (This is normally the file number of
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
273 the socket.) Both functions return the same value;
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
274 \method{connectionnumber()} is named after the corresponding function in
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
275 X11 and STDWIN, while \method{fileno()} makes it possible to use the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
276 \module{stdwin} module as a ``file'' object parameter to
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
277 \function{select.select()}. Note that if \constant{select()} implies that
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
278 input is possible on \module{stdwin}, this does not guarantee that an
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
279 event is ready --- it may be some internal communication going on
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
280 between the X server and the client library. Thus, you should call
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
281 \function{stdwin.pollevent()} until it returns \code{None} to check for
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
282 events if you don't want your program to block. Because of internal
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
283 buffering in X11, it is also possible that \function{stdwin.pollevent()}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
284 returns an event while \function{select()} does not find \module{stdwin} to
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
285 be ready, so you should read any pending events with
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
286 \function{stdwin.pollevent()} until it returns \code{None} before entering
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
287 a blocking \function{select()} call.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
288 \withsubitem{(in module select)}{\ttindex{select()}}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
289 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
290
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
291 \subsection{Window Objects}
4728
b218f294b726 (lib<all sorts of stuff>.tex):
Fred Drake <fdrake@acm.org>
parents: 2609
diff changeset
292 \nodename{STDWIN Window Objects}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
293
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
294 Window objects are created by \function{stdwin.open()}. They are closed
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
295 by their \method{close()} method or when they are garbage-collected.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
296 Window objects have the following methods:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
297
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
298 \begin{methoddesc}[window]{begindrawing}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
299 Return a drawing object, whose methods (described below) allow drawing
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
300 in the window.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
301 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
302
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
303 \begin{methoddesc}[window]{change}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
304 Invalidate the given rectangle; this may cause a draw event.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
305 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
306
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
307 \begin{methoddesc}[window]{gettitle}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
308 Returns the window's title string.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
309 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
310
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
311 \begin{methoddesc}[window]{getdocsize}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
312 \begin{sloppypar}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
313 Return a pair of integers giving the size of the document as set by
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
314 \method{setdocsize()}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
315 \end{sloppypar}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
316 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
317
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
318 \begin{methoddesc}[window]{getorigin}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
319 Return a pair of integers giving the origin of the window with respect
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
320 to the document.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
321 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
322
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
323 \begin{methoddesc}[window]{gettitle}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
324 Return the window's title string.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
325 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
326
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
327 \begin{methoddesc}[window]{getwinsize}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
328 Return a pair of integers giving the size of the window.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
329 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
330
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
331 \begin{methoddesc}[window]{getwinpos}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
332 Return a pair of integers giving the position of the window's upper
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
333 left corner (relative to the upper left corner of the screen).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
334 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
335
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
336 \begin{methoddesc}[window]{menucreate}{title}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
337 Create a menu object referring to a local menu (a menu that appears
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
338 only in this window).
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
339 Methods of menu objects are described below.
20580
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
340 \warning{The menu only appears as long as the object
376ee174ecd0 Use the \note and \warning macros where appropriate.
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
341 returned by this call exists.}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
342 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
343
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
344 \begin{methoddesc}[window]{scroll}{rect, point}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
345 Scroll the given rectangle by the vector given by the point.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
346 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
347
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
348 \begin{methoddesc}[window]{setdocsize}{point}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
349 Set the size of the drawing document.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
350 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
351
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
352 \begin{methoddesc}[window]{setorigin}{point}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
353 Move the origin of the window (its upper left corner)
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
354 to the given point in the document.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
355 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
356
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
357 \begin{methoddesc}[window]{setselection}{i, str}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
358 Attempt to set X11 selection number \var{i} to the string \var{str}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
359 (See \module{stdwin} function \function{getselection()} for the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
360 meaning of \var{i}.) Return true if it succeeds.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
361 If succeeds, the window ``owns'' the selection until
1767
907605320a5f Lots of small corrections by Andrew Kuchling (plus all new rotor docs)
Guido van Rossum <guido@python.org>
parents: 1471
diff changeset
362 (a) another application takes ownership of the selection; or
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
363 (b) the window is deleted; or
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
364 (c) the application clears ownership by calling
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
365 \function{stdwin.resetselection(\var{i})}. When another application
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
366 takes ownership of the selection, a \constant{WE_LOST_SEL} event is
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
367 received for no particular window and with the selection number as
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
368 detail. Ignored on the Macintosh.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
369 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
370
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
371 \begin{methoddesc}[window]{settimer}{dsecs}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
372 Schedule a timer event for the window in \code{\var{dsecs}/10}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
373 seconds.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
374 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
375
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
376 \begin{methoddesc}[window]{settitle}{title}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
377 Set the window's title string.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
378 \end{methoddesc}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
379
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
380 \begin{methoddesc}[window]{setwincursor}{name}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
381 \begin{sloppypar}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
382 Set the window cursor to a cursor of the given name. It raises
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
383 \exception{RuntimeError} if no cursor of the given name exists.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
384 Suitable names include
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
385 \code{'ibeam'},
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
386 \code{'arrow'},
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
387 \code{'cross'},
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
388 \code{'watch'}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
389 and
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
390 \code{'plus'}.
9002
7116cb9712bc Fix markup where C include files get named in <...> form; bug reported by
Fred Drake <fdrake@acm.org>
parents: 8918
diff changeset
391 On X11, there are many more (see \code{<X11/cursorfont.h>}).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
392 \end{sloppypar}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
393 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
394
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
395 \begin{methoddesc}[window]{setwinpos}{h, v}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
396 Set the the position of the window's upper left corner (relative to
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
397 the upper left corner of the screen).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
398 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
399
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
400 \begin{methoddesc}[window]{setwinsize}{width, height}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
401 Set the window's size.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
402 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
403
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
404 \begin{methoddesc}[window]{show}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
405 Try to ensure that the given rectangle of the document is visible in
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
406 the window.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
407 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
408
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
409 \begin{methoddesc}[window]{textcreate}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
410 Create a text-edit object in the document at the given rectangle.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
411 Methods of text-edit objects are described below.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
412 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
413
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
414 \begin{methoddesc}[window]{setactive}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 Attempt to make this window the active window. If successful, this
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
416 will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
417 another window in this application became inactive).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
418 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
419
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
420 \begin{methoddesc}[window]{close}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
421 Discard the window object. It should not be used again.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
422 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
423
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
424 \subsection{Drawing Objects}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
425
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
426 Drawing objects are created exclusively by the window method
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
427 \method{begindrawing()}. Only one drawing object can exist at any
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
428 given time; the drawing object must be deleted to finish drawing. No
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
429 drawing object may exist when \function{stdwin.getevent()} is called.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
430 Drawing objects have the following methods:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
431
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
432 \begin{methoddesc}[drawing]{box}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
433 Draw a box just inside a rectangle.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
434 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
435
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
436 \begin{methoddesc}[drawing]{circle}{center, radius}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
437 Draw a circle with given center point and radius.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
438 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
439
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
440 \begin{methoddesc}[drawing]{elarc}{center, (rh, rv), (a1, a2)}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
441 Draw an elliptical arc with given center point.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
442 \code{(\var{rh}, \var{rv})}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
443 gives the half sizes of the horizontal and vertical radii.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
444 \code{(\var{a1}, \var{a2})}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
445 gives the angles (in degrees) of the begin and end points.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
446 0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
447 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
448
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
449 \begin{methoddesc}[drawing]{erase}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
450 Erase a rectangle.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
451 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
452
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
453 \begin{methoddesc}[drawing]{fillcircle}{center, radius}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
454 Draw a filled circle with given center point and radius.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
455 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
456
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
457 \begin{methoddesc}[drawing]{fillelarc}{center, (rh, rv), (a1, a2)}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
458 Draw a filled elliptical arc; arguments as for \method{elarc()}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
459 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
460
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
461 \begin{methoddesc}[drawing]{fillpoly}{points}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
462 Draw a filled polygon given by a list (or tuple) of points.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
463 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
464
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
465 \begin{methoddesc}[drawing]{invert}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
466 Invert a rectangle.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
467 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
468
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
469 \begin{methoddesc}[drawing]{line}{p1, p2}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
470 Draw a line from point
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
471 \var{p1}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
472 to
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
473 \var{p2}.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
474 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
475
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
476 \begin{methoddesc}[drawing]{paint}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
477 Fill a rectangle.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
478 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
479
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
480 \begin{methoddesc}[drawing]{poly}{points}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
481 Draw the lines connecting the given list (or tuple) of points.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
482 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
483
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
484 \begin{methoddesc}[drawing]{shade}{rect, percent}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
485 Fill a rectangle with a shading pattern that is about
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
486 \var{percent}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
487 percent filled.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
488 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
489
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
490 \begin{methoddesc}[drawing]{text}{p, str}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
491 Draw a string starting at point p (the point specifies the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
492 top left coordinate of the string).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
493 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
494
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
495 \begin{methoddesc}[drawing]{xorcircle}{center, radius}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
496 \funcline{xorelarc}{center, (rh, rv), (a1, a2)}
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
497 \funcline{xorline}{p1, p2}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
498 \funcline{xorpoly}{points}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
499 Draw a circle, an elliptical arc, a line or a polygon, respectively,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
500 in XOR mode.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
501 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
502
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
503 \begin{methoddesc}[drawing]{setfgcolor}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
504 \funcline{setbgcolor}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
505 \funcline{getfgcolor}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
506 \funcline{getbgcolor}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
507 These functions are similar to the corresponding functions described
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
508 above for the \module{stdwin}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
509 module, but affect or return the colors currently used for drawing
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
510 instead of the global default colors.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
511 When a drawing object is created, its colors are set to the window's
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
512 default colors, which are in turn initialized from the global default
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
513 colors when the window is created.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
514 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
515
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
516 \begin{methoddesc}[drawing]{setfont}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
517 \funcline{baseline}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
518 \funcline{lineheight}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
519 \funcline{textbreak}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
520 \funcline{textwidth}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
521 These functions are similar to the corresponding functions described
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
522 above for the \module{stdwin}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
523 module, but affect or use the current drawing font instead of
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
524 the global default font.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
525 When a drawing object is created, its font is set to the window's
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
526 default font, which is in turn initialized from the global default
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
527 font when the window is created.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
528 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
529
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
530 \begin{methoddesc}[drawing]{bitmap}{point, bitmap, mask}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
531 Draw the \var{bitmap} with its top left corner at \var{point}.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
532 If the optional \var{mask} argument is present, it should be either
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
533 the same object as \var{bitmap}, to draw only those bits that are set
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
534 in the bitmap, in the foreground color, or \code{None}, to draw all
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
535 bits (ones are drawn in the foreground color, zeros in the background
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
536 color).
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
537 Not available on the Macintosh.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
538 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
539
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
540 \begin{methoddesc}[drawing]{cliprect}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
541 Set the ``clipping region'' to a rectangle.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
542 The clipping region limits the effect of all drawing operations, until
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
543 it is changed again or until the drawing object is closed. When a
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
544 drawing object is created the clipping region is set to the entire
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
545 window. When an object to be drawn falls partly outside the clipping
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
546 region, the set of pixels drawn is the intersection of the clipping
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
547 region and the set of pixels that would be drawn by the same operation
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
548 in the absence of a clipping region.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
549 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
550
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
551 \begin{methoddesc}[drawing]{noclip}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
552 Reset the clipping region to the entire window.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
553 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
554
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
555 \begin{methoddesc}[drawing]{close}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
556 \funcline{enddrawing}{}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
557 Discard the drawing object. It should not be used again.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
558 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
559
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
560 \subsection{Menu Objects}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
561
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
562 A menu object represents a menu.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
563 The menu is destroyed when the menu object is deleted.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
564 The following methods are defined:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
565
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
566
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
567 \begin{methoddesc}[menu]{additem}{text, shortcut}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
568 Add a menu item with given text.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
569 The shortcut must be a string of length 1, or omitted (to specify no
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
570 shortcut).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
571 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
572
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
573 \begin{methoddesc}[menu]{setitem}{i, text}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
574 Set the text of item number \var{i}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
575 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
576
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
577 \begin{methoddesc}[menu]{enable}{i, flag}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
578 Enable or disables item \var{i}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
579 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
580
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
581 \begin{methoddesc}[menu]{check}{i, flag}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
582 Set or clear the \dfn{check mark} for item \var{i}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
583 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
584
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
585 \begin{methoddesc}[menu]{close}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
586 Discard the menu object. It should not be used again.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
587 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
588
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
589 \subsection{Bitmap Objects}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
590
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
591 A bitmap represents a rectangular array of bits.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
592 The top left bit has coordinate (0, 0).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
593 A bitmap can be drawn with the \method{bitmap()} method of a drawing object.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
594 Bitmaps are currently not available on the Macintosh.
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
595
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
596 The following methods are defined:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
597
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
598
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
599 \begin{methoddesc}[bitmap]{getsize}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
600 Return a tuple representing the width and height of the bitmap.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
601 (This returns the values that have been passed to the
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
602 \function{newbitmap()} function.)
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
603 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
604
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
605 \begin{methoddesc}[bitmap]{setbit}{point, bit}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
606 Set the value of the bit indicated by \var{point} to \var{bit}.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
607 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
608
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
609 \begin{methoddesc}[bitmap]{getbit}{point}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
610 Return the value of the bit indicated by \var{point}.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
611 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
612
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
613 \begin{methoddesc}[bitmap]{close}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
614 Discard the bitmap object. It should not be used again.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
615 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
616
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 1767
diff changeset
617 \subsection{Text-edit Objects}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
618
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
619 A text-edit object represents a text-edit block.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
620 For semantics, see the STDWIN documentation for \C{} programmers.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
621 The following methods exist:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
622
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
623
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
624 \begin{methoddesc}[text-edit]{arrow}{code}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
625 Pass an arrow event to the text-edit block.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
626 The \var{code} must be one of \constant{WC_LEFT}, \constant{WC_RIGHT},
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
627 \constant{WC_UP} or \constant{WC_DOWN} (see module
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
628 \refmodule{stdwinevents}).
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
629 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
630
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
631 \begin{methoddesc}[text-edit]{draw}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
632 Pass a draw event to the text-edit block.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
633 The rectangle specifies the redraw area.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
634 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
635
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
636 \begin{methoddesc}[text-edit]{event}{type, window, detail}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
637 Pass an event gotten from
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
638 \function{stdwin.getevent()}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
639 to the text-edit block.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
640 Return true if the event was handled.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
641 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
642
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
643 \begin{methoddesc}[text-edit]{getfocus}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
644 Return 2 integers representing the start and end positions of the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
645 focus, usable as slice indices on the string returned by
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
646 \method{gettext()}.
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
647 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
648
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
649 \begin{methoddesc}[text-edit]{getfocustext}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
650 Return the text in the focus.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
651 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
652
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
653 \begin{methoddesc}[text-edit]{getrect}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
654 Return a rectangle giving the actual position of the text-edit block.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
655 (The bottom coordinate may differ from the initial position because
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
656 the block automatically shrinks or grows to fit.)
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
657 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
658
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
659 \begin{methoddesc}[text-edit]{gettext}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
660 Return the entire text buffer.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
661 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
662
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
663 \begin{methoddesc}[text-edit]{move}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
664 Specify a new position for the text-edit block in the document.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
665 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
666
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
667 \begin{methoddesc}[text-edit]{replace}{str}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
668 Replace the text in the focus by the given string.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
669 The new focus is an insert point at the end of the string.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
670 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
671
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
672 \begin{methoddesc}[text-edit]{setfocus}{i, j}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
673 Specify the new focus.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
674 Out-of-bounds values are silently clipped.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
675 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
676
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
677 \begin{methoddesc}[text-edit]{settext}{str}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
678 Replace the entire text buffer by the given string and set the focus
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
679 to \code{(0, 0)}.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
680 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
681
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
682 \begin{methoddesc}[text-edit]{setview}{rect}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
683 Set the view rectangle to \var{rect}. If \var{rect} is \code{None},
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
684 viewing mode is reset. In viewing mode, all output from the text-edit
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
685 object is clipped to the viewing rectangle. This may be useful to
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
686 implement your own scrolling text subwindow.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
687 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
688
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
689 \begin{methoddesc}[text-edit]{close}{}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
690 Discard the text-edit object. It should not be used again.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
691 \end{methoddesc}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
692
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
693 \subsection{Example}
2581
4d28b655b728 added nodename macro calls for new very long section names
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
694 \nodename{STDWIN Example}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
695
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
696 Here is a minimal example of using STDWIN in Python.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
697 It creates a window and draws the string ``Hello world'' in the top
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
698 left corner of the window.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
699 The window will be correctly redrawn when covered and re-exposed.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
700 The program quits when the close icon or menu item is requested.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
701
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
702 \begin{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
703 import stdwin
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
704 from stdwinevents import *
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
705
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
706 def main():
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
707 mywin = stdwin.open('Hello')
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
708 #
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
709 while 1:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
710 (type, win, detail) = stdwin.getevent()
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
711 if type == WE_DRAW:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
712 draw = win.begindrawing()
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
713 draw.text((0, 0), 'Hello, world')
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
714 del draw
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
715 elif type == WE_CLOSE:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
716 break
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
717
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
718 main()
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
719 \end{verbatim}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
720
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
721
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
722 \section{\module{stdwinevents} ---
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
723 Constants for use with \module{stdwin}}
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
724
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
725 \declaremodule{standard}{stdwinevents}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
726 \modulesynopsis{Constant definitions for use with \module{stdwin}}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
727
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
728
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
729 This module defines constants used by STDWIN for event types
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
730 (\constant{WE_ACTIVATE} etc.), command codes (\constant{WC_LEFT} etc.)
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
731 and selection types (\constant{WS_PRIMARY} etc.).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
732 Read the file for details.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
733 Suggested usage is
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
734
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
735 \begin{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
736 >>> from stdwinevents import *
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
737 >>>
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
738 \end{verbatim}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
739
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
740
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
741 \section{\module{rect} ---
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
742 Functions for use with \module{stdwin}}
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
743
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
744 \declaremodule{standard}{rect}
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
745 \modulesynopsis{Geometry-related utility function for use with
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
746 \module{stdwin}.}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8202
diff changeset
747
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
748
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
749 This module contains useful operations on rectangles.
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
750 A rectangle is defined as in module \refmodule{stdwin}:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
751 a pair of points, where a point is a pair of integers.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
752 For example, the rectangle
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
753
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
754 \begin{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
755 (10, 20), (90, 80)
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
756 \end{verbatim}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
757
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
758 is a rectangle whose left, top, right and bottom edges are 10, 20, 90
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
759 and 80, respectively. Note that the positive vertical axis points
10703
e4e800a78d8d Make internal module references hyperlinks wherever it makes sense.
Fred Drake <fdrake@acm.org>
parents: 10520
diff changeset
760 down (as in \refmodule{stdwin}).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
761
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
762 The module defines the following objects:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
763
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
764 \begin{excdesc}{error}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
765 The exception raised by functions in this module when they detect an
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
766 error. The exception argument is a string describing the problem in
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
767 more detail.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
768 \end{excdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
769
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
770 \begin{datadesc}{empty}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
771 The rectangle returned when some operations return an empty result.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
772 This makes it possible to quickly check whether a result is empty:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
773
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
774 \begin{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
775 >>> import rect
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
776 >>> r1 = (10, 20), (90, 80)
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
777 >>> r2 = (0, 0), (10, 20)
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
778 >>> r3 = rect.intersect([r1, r2])
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
779 >>> if r3 is rect.empty: print 'Empty intersection'
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
780 Empty intersection
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
781 >>>
7277
bf4e790bd61a Remove all \bcode / \ecode cruft; this is no longer needed. See previous
Fred Drake <fdrake@acm.org>
parents: 7096
diff changeset
782 \end{verbatim}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
783 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
784
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
785 \begin{funcdesc}{is_empty}{r}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
786 Returns true if the given rectangle is empty.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
787 A rectangle
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
788 \code{(\var{left}, \var{top}), (\var{right}, \var{bottom})}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
789 is empty if
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
790 \begin{math}\var{left} \geq \var{right}\end{math} or
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
791 \begin{math}\var{top} \geq \var{bottom}\end{math}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
792 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
793
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
794 \begin{funcdesc}{intersect}{list}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
795 Returns the intersection of all rectangles in the list argument.
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
796 It may also be called with a tuple argument. Raises
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
797 \exception{rect.error} if the list is empty. Returns
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
798 \constant{rect.empty} if the intersection of the rectangles is empty.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
799 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
800
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
801 \begin{funcdesc}{union}{list}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
802 Returns the smallest rectangle that contains all non-empty rectangles in
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
803 the list argument. It may also be called with a tuple argument or
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
804 with two or more rectangles as arguments. Returns
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
805 \constant{rect.empty} if the list is empty or all its rectangles are
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
806 empty.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
807 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
808
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7357
diff changeset
809 \begin{funcdesc}{pointinrect}{point, rect}
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
810 Returns true if the point is inside the rectangle. By definition, a
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
811 point \code{(\var{h}, \var{v})} is inside a rectangle
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
812 \code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} if
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
813 \begin{math}\var{left} \leq \var{h} < \var{right}\end{math} and
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
814 \begin{math}\var{top} \leq \var{v} < \var{bottom}\end{math}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
815 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
816
9537
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
817 \begin{funcdesc}{inset}{rect, (dh, dv)}
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
818 Returns a rectangle that lies inside the \var{rect} argument by
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
819 \var{dh} pixels horizontally and \var{dv} pixels vertically. If
f17ceda6e666 Logical markup.
Fred Drake <fdrake@acm.org>
parents: 9002
diff changeset
820 \var{dh} or \var{dv} is negative, the result lies outside \var{rect}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
821 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
822
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
823 \begin{funcdesc}{rect2geom}{rect}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
824 Converts a rectangle to geometry representation:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
825 \code{(\var{left}, \var{top}), (\var{width}, \var{height})}.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
826 \end{funcdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
827
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
828 \begin{funcdesc}{geom2rect}{geom}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
829 Converts a rectangle given in geometry representation back to the
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
830 standard rectangle representation
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
831 \code{(\var{left}, \var{top}), (\var{right}, \var{bottom})}.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
832 \end{funcdesc}