Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: December 2012

URL: http://cxc.harvard.edu/chips/add_window.html
AHELP for CIAO 4.5 ChIPS v1

add_window

Context: windows

Synopsis

Creates a window.

Syntax

add_window( [ChipsId,] [attributes])
add_window( [ChipsId,] width, height, units [,attributes] )

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • width - window width
  • height - window height
  • units - units of the width and height (one of "inches", "cm", "mm", or "pixels").
  • attributes - optional parameters which allow the user to configure properties though a structure, list, or attribute string.

The add_window command creates a window whose attributes are specified by user preferences or in an attribute list. The new window becomes current by default; providing a ChipsId overrides the currency state.

Customizing the Window

There are several attributes that control the window characteristics. The attributes can be set to the ChIPS defaults, values provided in the add_window command, or values from the user's preference file.

Some of these attributes may also be modified with the set_window command at any time; see "ahelp set_window" and "ahelp setget" for more information.

Please see the section "Window Preferences and Attributes" below the examples for a list of the window preferences.

Example 1

chips> add_window()

Create a new ChIPS window.

Example 2

chips> add_window(["bgcolor", "navy", "id", "fig1"])

Add a window, specifying the attribute values in a list: the background color should be navy and the id - as reported by info() and used by current_window() - should be "fig1".

Example 3

chips> add_window(["display", False])
chips> add_curve([1,2,3], [-5,9,2], ["symbol.style", "none"])
chips> add_label(2, -2, r"\alpha=0.2", ["size", 16])
chips> print_window("plot.ps")
chips> print info()
chips> set_window(["display", True])

A window is created with the display setting set to False, which means that no visible window will be created. A curve and label are added, and a postscript plot (called plot.ps) is created. The output of info() is as follows, which shows that the objects (e.g. curve and label) have been created, they have just not been displayed to the screen:

Window [win1]
  Frame [frm1]
    Plot [plot1]   (0.15,0.15)  .. (0.90,0.90)
      Border bottom [bx1]  top [bx2]  left [by1]  right [by2]
      X Axis [ax1]
      Y Axis [ay1]
      Curve [crv1]
      Label [lbl1]

The final call - to set_window() - changes the display setting to True, at which point a window will appear on screen. Any future changes to the visualization will now be immediately visible (until the display setting is changed back to False).

Example 4

chips> add_window(["geom", "+0+50", "id", "fig1", "prefix", ">>"])

Create a window, telling the window manager to place it at the left edge of the screen and with its top edge 50 pixels from the top of the screen (note that the window manager may not honor this request). The id of the window is set to "fig1", and the prefix ">>", which means that the window title will be ">>fig1" (which may or may not be displayed by the window manager).

If you want a space to be included in the prefix then the value must be doubly quoted: e.g.

chips> add_window(["prefix", "\"chips - \""])

Example 5

chips> ws = ChipsWindow()
chips> ws.bgcolor = "blue"
chips> ws.width = 20
chips> ws.height = 15
chips> ws.units = "cm"
chips> add_window(ws)

Populate the "ws" structure with the attribute values, then add a window.

Window Preferences and Attributes

The attributes associated with windows are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_window() command. To change the window preference settings prepend "window." to the attribute name.

Attribute Description Options Default Set?
bgcolor Background Color of the window name or hex; see the Color section of "ahelp chipsopt" default: white in the ChIPS window, black on printout Yes
display Flag indicating whether the window should be rendered see the Booleans section of "ahelp chipsopt" true Yes
height window height Numerical value expressed in either inches, centimeters, millimeters or pixels 360 pixels No
scaleheight factor to scale window to display at approximate height positive floating point value 1.25 No
scalewidth factor to scale window to display at approximate width positive floating point value 1.25 No
smoothing use VTK's smoothing to reduce anti-aliasing see the Booleans section of "ahelp chipsopt" false No
stem Stem used for window id An alpha-numeric character sequence that does not contain a space win No
prefix Prefix added to window id to create the text that the window manager may use to label the ChIPS window. "chips - " No
geom A geometry hint to the window manager to say where the ChIPS window should be created (this setting may be ignored, depending on the window manager in use). The format is either a blank string or a string containing two signed integers such as "+100+50", "+0+20", or "+0+0". No
units Units of the window width and height dimensions inches|cm|mm|pixels pixels No
width window width Numerical value expressed in either inches, centimeters, millimeters or pixels 360 pixels No

Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

chips
chips, chipsgui, chipsrc, show_gui
concepts
aspectratio, attributes, chipsid, chipsopt, colors, coordsys, currency, depthcontrol, entitycreation, preferences, setget
utilities
clear
windows
current_window, deiconify_window, delete_window, get_window, iconify_window, print_window, set_window

Last modified: December 2012
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2012. All rights reserved.