Next: Drawing Object
Prev: Functions Defined in Module stdwin
Up: stdwin
Top: Top
8.1.2. Window Object Methods
Window objects are created by stdwin.open()
. They are closed
by their close()
method or when they are garbage-collected.
Window objects have the following methods:
- begindrawing () -- Method on window
-
Return a drawing object, whose methods (described below) allow drawing
in the window.
- change (rect) -- Method on window
-
Invalidate the given rectangle; this may cause a draw event.
- gettitle () -- Method on window
-
Returns the window's title string.
- getdocsize () -- Method on window
-
Return a pair of integers giving the size of the document as set by
setdocsize()
.
- getorigin () -- Method on window
-
Return a pair of integers giving the origin of the window with respect
to the document.
- gettitle () -- Method on window
-
Return the window's title string.
- getwinsize () -- Method on window
-
Return a pair of integers giving the size of the window.
- getwinpos () -- Method on window
-
Return a pair of integers giving the position of the window's upper
left corner (relative to the upper left corner of the screen).
- menucreate (title) -- Method on window
-
Create a menu object referring to a local menu (a menu that appears
only in this window).
Methods of menu objects are described below.
Warning: the menu only appears as long as the object
returned by this call exists.
- scroll (rect, point) -- Method on window
-
Scroll the given rectangle by the vector given by the point.
- setdocsize (point) -- Method on window
-
Set the size of the drawing document.
- setorigin (point) -- Method on window
-
Move the origin of the window (its upper left corner)
to the given point in the document.
- setselection (i, str) -- Method on window
-
Attempt to set X11 selection number
i
to the string
str.
(See stdwin method
getselection()
for the meaning of
i.)
Return true if it succeeds.
If succeeds, the window ``owns'' the selection until
(a) another applications takes ownership of the selection; or
(b) the window is deleted; or
(c) the application clears ownership by calling
stdwin.resetselection(i)
.
When another application takes ownership of the selection, a
WE_LOST_SEL
event is received for no particular window and with the selection number
as detail.
Ignored on the Macintosh.
- settimer (dsecs) -- Method on window
-
Schedule a timer event for the window in
dsecs/10
seconds.
- settitle (title) -- Method on window
-
Set the window's title string.
- setwincursor (name) -- Method on window
-
Set the window cursor to a cursor of the given name.
It raises the
RuntimeError
exception if no cursor of the given name exists.
Suitable names include
'ibeam'
,
'arrow'
,
'cross'
,
'watch'
and
'plus'
.
On X11, there are many more (see
<X11/cursorfont.h>).
- setwinpos (h, v) -- Method on window
-
Set the the position of the window's upper left corner (relative to
the upper left corner of the screen).
- setwinsize (width, height) -- Method on window
-
Set the window's size.
- show (rect) -- Method on window
-
Try to ensure that the given rectangle of the document is visible in
the window.
- textcreate (rect) -- Method on window
-
Create a text-edit object in the document at the given rectangle.
Methods of text-edit objects are described below.
- setactive () -- Method on window
-
Attempt to make this window the active window. If successful, this
will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case
another window in this application became inactive).
- close () -- Method on window
-
Discard the window object. It should not be used again.