Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/SetGet.html
AHELP for CIAO 4.11 ChIPS v1

setget

Context: concepts

Synopsis

Methods of obtaining and modifying the attributes of object.

Description

There are various methods of accessing and modifying attribute values in ChIPS, ranging from general commands to attribute-specific methods. In general, these are known as "set" (modify an attribute value) and "get" (obtain an attribute value) commands.

ChIPS GUI

The ChIPS GUI allows you to edit the attributes of objects using a GUI rather than the command line. When in "Select" mode, clicking in the ChIPS window will highlight the object under the click (square "handles" will appear at the edges of the object). At this point, selecting the "Edit <Object>" menu item brought up by the right-menu button will create a dialog window which will let you edit the properties of the object. Alternatively, the object can be selected from the object list in the main window of the ChIPS GUI, and its attributes edited from there.

Bringing up the GUI

The GUI can be launched by right clicking on an existing ChIPS window and selecting "Show GUI", or by running the show_gui command from the ChIPS command line.

General Accessors

The generic set_attribute and get_attribute commands may be used to access attributes of any type of ChIPS object. The attributes ahelp file has general information on configuring object properties.

Object Accessors

Object accessors act on specific ChIPS objects. The function name contains the object_type value.

set_axis([id,] attributes)
set_colorbar([id,] attributes)
set_contour([id,] attributes)
set_curve([id,] attributes)
set_frame([id,] attributes)
set_histogram([id,] attributes)
set_image([id,] attributes)
set_label([id,] attributes)
set_line([id,] attributes)
set_plot([id,] attributes)
set_point([id,] attributes)
set_region([id,] attributes)
set_window([id,] attributes)

Each of the set accessors has a help file; refer to "ahelp set_<object>" for more information and examples.

The get_<object> accessors return all the attribute values of the object type. To retrieve the value of a specific attribute, provide the attribute name and the id or ChipsId of the object.

get_axis([id [,attribute])
get_colorbar([id [,attribute])
get_contour([id [,attribute])
get_curve([id [,attribute])
get_frame([id [,attribute])
get_histogram([id [,attribute])
get_image([id [,attribute])
get_label([id [,attribute])
get_line([id [,attribute])
get_plot([id [,attribute])
get_point([id [,attribute])
get_region([id [,attribute])
get_window([id [,attribute])

Each of the get accessors has a help file; refer to "ahelp get_<object>" for more information and examples.

Identifying the object

The id argument in these commands accepts either a string, containing the name of the object in question, or a ChipsId object.


The set_attribute_command

The set_attribute command sets one or more attribute values.

set_attribute([id,] object_type, attributes)

The routine takes an optional ChipsId structure containing attributes to modify the currency state for the command. The object_type tells ChIPS what type of object to modify, such as chips_window or chips_curve; see the Object Type section of "ahelp chipsopt". The attributes parameter is one of:

Examples of using set_attribute:

set_attribute(chips_label, ["angle": 45])
set_attribute(chips_axis, ["*.color", "green", "*.font", "times"])
set_attribute("reg1", chips_region, ["fill.color", "blue"])
set_attribute(chips_label, {"angle": 45})
set_attribute(chips_axis, {"*.color": "green", "*.font": "times"})
set_attribute("reg1", chips_region, {"fill.color": "blue"})
set_attribute(chips_label, "angle=45")
set_attribute(chips_axis, "*.color=green *.font=times")
set_attribute("reg1", chips_region, "fill.color=blue")
crv = ChipsCurve()
crv.line.thickness = 2
crv.symbol.style = 'circle'
crv.symbol.fill = False
crv.all.color = 0xFE324C
set_attribute(chips_curve, crv)

Refer to the set_attribute ahelp page for more examples.

The get_attribute_command

The get_attribute command retrieves the value of a specific attribute. If an attribute is not specified, the values of all attributes of the specified object are returned.

get_attribute([id,] object_type, [attribute])

The routine takes an optional ChipsId structure containing values to modify the currency state for the command. The object_type tells ChIPS what type of object to modify, such as chips_window or chips_curve; see the Object Type section of "ahelp chipsopt". The attribute parameter is a single object attribute from which to obtain the value.

Examples of using get_attribute:

get_attribute("lbl1", chips_label)
get_attribute("crv1", chips_curve, "symbol.size")

Refer to the get_attribute ahelp page for more examples.

Attribute-specific Accessors

The module of advanced ChIPS functions contains attribute-specific accessor methods which may be used to retrieve and modify the values of individual object attributes. An accessor exists for every attribute of each ChIPS object; refer to "ahelp chips" for information on loading the module. For example:

set_curve_linecolor([ChipsId,] color)
set_label_font([ChipsId,] font)
set_histogram_depth([ChipsId,] depth)
get_axis_tickformat([ChipsId])
get_window_bgcolor([ChipsId])
get_axis_color([ChipsId])

The get routines can only operate on a single object. An error is returned if currency is set to "all".

Examples of using attribute-specific accessors:

from pychips.advanced import *
set_curve_linecolor("red")
set_frame_bgcolor("frm1", "8f40af")
get_axis_major_mode("ax1")
get_curve_symbolstyle()

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
utilities
set_current