next up previous contents index
Next: Changing the Window Style Up: Device Control Previous: Device Control   Contents   Index


Window Control

Calling Sequences
...

 
window ([n] [, <keylist>]) 
winkill ([n]) 
n = current_window () 
fma()

Description
The window function selects device n as the current graphics device. n may range from 0 to 7, inclusive. Each graphics device corresponds to an X window, a hardcopy file, or both, depending on the values of the keyword arguments described below. If n is omitted, it defaults to the current active device, if any. window returns the number of the currently active device. winkill deletes the current graphics device, or device n if n is specified. current_window returns the number of the current active device, or -1 if there is none. fma frame advances the current graphics device. The current picture remains displayed in the associated X window (if any) until the next element is actually plotted. An fma must be given after the last plot to a hardcopy file for that plot to appear when the file is printed.

The keywords accepted by the window function are

 
display, dpi, dump, hcp, legends, private, style, wait
and are described in the next subsection.

Keyword Arguments
The following keyword arguments can be specified with this function. display A string of the form host: server. screen which tells where the X window will appear (for example, icf.llnl.gov: 0.0). If not specified, uses your default display (which it gets from your DISPLAY environment variable). Use display = "" (the null string) to create a graphics device which has no associated X window. (You should do this if you want to make plots in a non-interactive batch mode.)

dpi
The allowed values for dpi are 75 and 100. The X window will appear on your default display at 75 dpi, unless you specify the display and/ or dpi keywords. A dpi = 100 X window is larger than a dpi = 75 X window; both represent the same thing on paper.

dump
The dump keyword, if present, controls whether all colors are converted to a gray scale (dump = 0, the default), or the current palette is dumped at the beginning of each page of hardcopy output. Set dump to 1 if you are doing color plots. The dump keyword applies only to the specific hardcopy file defined using the hcp keyword (see below)--use the dump keyword in the hcp_file command to get the same effect in the default hardcopy file.

hcp
The value of this keyword is a quoted string giving a file name. By default, a graphics window does NOT have a hardcopy file of its own--any requests for hardcopy are directed to the default hardcopy file, so hardcopy output from any window goes to a single file. By specifying the hcp keyword, however, a hardcopy file unique to this window will be created. If the hcp filename ends in . ps, then the hardcopy file will be a PostScript file; otherwise, hardcopy files are in binary CGM format. Use hcp = "" (the null string) to revert to the default hardcopy file (closing the window specific file, if any).

In the next section of this manual we shall consider the hardcopy and file functions. Note that the PyGist default is to write to a hardcopy file only on demand. (See function hcp on page [*])

legends
The legends keyword, if present, controls whether the curve legends are (legends = 1, the default) or are not (legends = 0) dumped to the hardcopy file. The legends keyword applies to all pictures dumped to hardcopy from this graphics window. Legends are never plotted to the X window.

private
By default, an X window will attempt to use shared colors, which permits several PyGist graphics windows (including windows from multiple instances of Python) to use a common palette. You can force an X window to post its own colormap (set its colormap attribute) with the private = 1 keyword. You will most likely have to fiddle with your window manager to understand how it handles colormap focus if you do this. Use private = 0 to return to shared colors.

style
The style keyword, if present, specifies (as a quoted string) the name of a Gist stylesheet file; the default is work.gs. The style sheet determines the number and location of coordinate systems, tick and label styles, and the like. Here are brief descriptions of the available stylesheets:

axes.gs
axes with labeled tick marks along bottom and left of graph. boxed.gs: lines all the way around the plot with tick marks, labeled along bottom and left.

boxed2.gs
same as boxed.gs but no tick marks on the top and right sides.
l_nobox.gs
no box, axes, or ticks; graph extends all the way to edge of window.
nobox.gs
indistinguishable from l_nobox.gs. vg.gs: large tick marks all the way around the graph, but no lines, with large infrequent labels on the bottom and left.

vgbox.gs
same as vg.gs except with lines all the way around as well
work.gs
small tick marks with small, frequent labels on bottom and left, no lines.
work2.gs
similar to work.gs, but no ticks along top and right. wait By default, Python will not wait for the X window to become visible. Code which creates a new window, then plots a series of frames to that window should use wait = 1 to assure that all frames are actually plotted.

Examples
The first example ensures that an old window 0 is not hanging around, and then creates a new 100 dpi window.

winkill(0) 
window (0, wait = 1, dpi = 100)

The second example changes the style sheet of window 2.

window (2, style = "vgbox.gs")


next up previous contents index
Next: Changing the Window Style Up: Device Control Previous: Device Control   Contents   Index
Michiel Jan Laurens de Hoon 2003-04-19