Colormap object -- X Python Reference Manual

Next: Pixmap object Prev: Graphics Context object Up: Xt Top: Top

# 3.7. Colormap object

Colormap objects are used to represent the `Colormap` type. A Colormap object can be obtained using the widget method `CreateColormap` (which also needs a Visual Info object) or the widget method `DefaultColormapOfScreen`. A Colormap object can be used in the widget method `SetWindowColormap` and as the `colormap` resource of widgets.

Colormap objects (cm_objects) have the following methods:

AllocColor (red, green, blue)
  Returns `(pixel, red, green, blue, flags)`. This function corresponds with `XAllocColor`.

AllocColorCells (contig, nplanes, npixels)
  Returns `(plane_masks_list, pixels_list)`. This function corresponds with `XAllocColorCells`.

AllocNamedColor (color_name)
  Returns `((screen_def.pixel, screen_def.red, screen_def.green, screen_def.blue, screen_def.flags), (exact_def.pixel, exact_def.red, exact_def.green, exact_def.blue, exact_def.flags))`. This function corresponds with `XAllocNamedColor`.

FreeColors (pixel_list, planes)
  Returns `None`. This function corresponds with `XFreeColors`.

Install ()
  Returns `None`. This function corresponds with `XInstallColormap`.

InstallColormap ()
  Returns `None`. This function corresponds with `XInstallColormap`.

LookupColor (color_name)
  Returns `((exact_def.pixel, exact_def.red, exact_def.green, exact_def.blue, exact_def.flags), (screen_def.pixel, screen_def.red, screen_def.green, screen_def.blue, screen_def.flags))`. This function corresponds with `XLookupColor`.

ParseColor (color_name)
  Returns `(pixel, red, green, blue, flags)`. This function corresponds with `XParseColor`.

QueryColor (pixel)
  Returns `(pixel, red, green, blue, flags)`. This function corresponds with `XQueryColor`.

QueryColors (pixel_list)
  Returns `XColor_list`. This function corresponds with `XQueryColors`.

StoreColors (color_list)
  Returns `None`. This function corresponds with `XStoreColors`.

Next: Pixmap object Prev: Graphics Context object Up: Xt Top: Top