"bits_per_rgb"ReadThe number of significant bits per red, green, or blue
when specifying colors for this visual. (For instance, for the gtk.gdk.Colormap.alloc_color()
method)"blue_mask"ReadA mask giving the bits in a pixel value that correspond
to the blue field."blue_prec"ReadSee above."blue_shift"ReadThe blue_shift and
blue_prec give an alternate presentation of the
information in blue_mask. "byte_order"ReadThe byte-order for this visual - either:
gtk.gdk.LSB_FIRST or
gtk.gdk.MSB_FIRST."colormap_size"ReadThe number of entries in the colormap, for visuals of
type gtk.gdk.VISUAL_PSEUDO_COLOR or
gtk.gdk.VISUAL_GRAY_SCALE. For other visual types, it is
the number of possible levels per color component. If the visual has
different numbers of levels for different components, the value of this
field is undefined."depth"ReadThe number of bits per pixel."green_mask"ReadA mask giving the bits in a pixel value that correspond
to the green field."green_prec"ReadSee above."green_shift"ReadThe green_shift and
green_prec give an alternate presentation of the
information in green_mask."red_mask"ReadA mask giving the bits in a pixel value that correspond
to the red field. Significant only for
gtk.gdk.VISUAL_PSEUDOCOLOR and
gtk.gdk.VISUAL_DIRECTCOLOR."red_prec"ReadSee above."red_shift"ReadThe red_shift and
red_prec give an alternate presentation of the
information in red_mask.
red_mask is a contiguous sequence of
red_prec bits starting at bit number
red_shift."type"ReadThe type of this visual - one of:
gtk.gdk.VISUAL_STATIC_GRAY,
gtk.gdk.VISUAL_GRAYSCALE,
gtk.gdk.VISUAL_STATIC_COLOR,
gtk.gdk.VISUAL_PSEUDO_COLOR,
gtk.gdk.VISUAL_TRUE_COLOR,
gtk.gdk.VISUAL_DIRECT_COLOR
DescriptionA gtk.gdk.Visual
describes a particular video hardware display format. It includes
information about the number of bits used for each color, the way the bits
are translated into an RGB value for display, and the way the bits are
stored in memory. For example, a piece of display hardware might support
24-bit color, 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes.
For a given pixel size, pixels can be in different formats; for example the
"red" element of an RGB pixel may be in the top 8 bits of the pixel, or may
be in the lower 4 bits.Usually you can avoid thinking about visuals in
PyGTK. Visuals are useful to interpret the contents of a
gtk.gdk.Image,
but you should avoid gtk.gdk.Image
precisely because its contents depend on the display hardware; use gtk.gdk.Pixbuf
instead, for all but the most low-level purposes. Also, anytime you provide
a gtk.gdk.Colormap,
the visual is implied as part of the colormap (see the gtk.gdk.Colormap.get_visual()
method), so you won't have to provide a visual in addition.There are several standard visuals. The visual returned by the
gtk.gdk.visual_get_system()
function is the system's default visual. The gtk.gdk.rgb_get_visual()
function returns the visual most suited to displaying full-color image data.
If you use the calls in GdkRGB, you should create your windows using this
visual (and the colormap returned by the gtk.gdk.rgb_get_colormap()
function).A number of functions are provided for determining the "best"
available visual. For the purposes of making this determination, higher bit
depths are considered better, and for visuals of the same bit depth,
gtk.gdk.VISUAL_PSEUDO_COLOR is preferred at 8bpp,
otherwise, the visual types are ranked in the order of (highest to lowest)
gtk.gdk.VISUAL_DIRECT_COLOR,
gtk.gdk.VISUAL_TRUE_COLOR,
gtk.gdk.VISUAL_PSEUDO_COLOR,
gtk.gdk.VISUAL_STATIC_COLOR,
gtk.gdk.VISUAL_GRAYSCALE, then
gtk.gdk.VISUAL_STATIC_GRAY.Constructorgtk.gdk.Visualdepthvisual_typedepth :a bit depthvisual_type :a visual typeReturns :the best gtk.gdk.Visual with
both depth and visual_type, or
None if noneCreates a new gtk.gdk.Visual that
is the best choice for the specified depth and
visual_type. Color visuals and visuals with mutable
colormaps are preferred over grayscale or fixed-colormap visuals and visuals
with higher color depths are considered better. The value of
visual_type must be one of:gtk.gdk.VISUAL_STATIC_GRAYEach pixel value indexes a grayscale value
directly.gtk.gdk.VISUAL_GRAYSCALEEach pixel is an index into a color map that maps pixel
values into grayscale values. The color map can be changed by an
application.gtk.gdk.VISUAL_STATIC_COLOREach pixel value is an index into a predefined,
unmodifiable color map that maps pixel values into RGB values.gtk.gdk.VISUAL_PSEUDO_COLOREach pixel is an index into a color map that maps pixel
values into rgb values. The color map can be changed by an
application.gtk.gdk.VISUAL_TRUE_COLOREach pixel value directly contains red, green, and blue
components. The red_mask, green_mask, and blue_mask fields of the gtk.gdk.Visual
structure describe how the components are assembled into a pixel
value.gtk.gdk.VISUAL_DIRECT_COLOREach pixel value contains red, green, and blue components
as for gtk.gdk.TRUE_COLOR, but the components are mapped
via a color table into the final output table instead of being converted
directly. Methodsgtk.gdk.Visual.get_screenget_screenReturns :the screen that this visual belongs
to.This method is available in PyGTK 2.2 and above.The get_screen() method returns the
gtk.gdk.Screen
that this visual belongs to.Functionsgtk.gdk.list_visualsgtk.gdk.list_visualsReturns :a list of gtk.gdk.Visual
objectsThe gtk.gdk.list_visuals() function returns
a list containing the available gtk.gdk.Visual
objects for the default screen.gtk.gdk.visual_get_bestgtk.gdk.visual_get_bestReturns :the best gtk.gdk.Visual for
the default screenThe gtk.gdk.visual_get_best() function
returns the visual with the most available colors for the default
screen.gtk.gdk.visual_get_best_depthgtk.gdk.visual_get_best_depthReturns :the best available depth.The gtk.gdk.visual_get_best_depth()
function returns the best available depth for the default GDK screen.
"Best" means "largest," i.e. 32 preferred over 24 preferred over 8 bits
per pixel.gtk.gdk.visual_get_best_typegtk.gdk.visual_get_best_typeReturns :the gtk.gdk.Visual with
the best type for the default screenThe gtk.gdk.visual_get_best_type() function
returns the best available gtk.gdk.Visual type
for the default screen.gtk.gdk.visual_get_best_with_depthgtk.gdk.visual_get_best_with_depthdepthdepth :the number of bits per
pixelReturns :the best gtk.gdk.Visual for
the specified depthThe gtk.gdk.visual_get_best_with_depth()
function returns the best gtk.gdk.Visual with
the specified depth.gtk.gdk.visual_get_best_with_typegtk.gdk.visual_get_best_with_typetypetype :a visual typeReturns :the best gdkVisual for the visual type
specified by typeThe gtk.gdk.visual_get_best_with_type()
function returns the best gtk.gdk.Visual for
the visual type specified by type. The value of
visual_type must be one of:gtk.gdk.VISUAL_STATIC_GRAYEach pixel value indexes a grayscale value
directly.gtk.gdk.VISUAL_GRAYSCALEEach pixel is an index into a color map that maps pixel
values into grayscale values. The color map can be changed by an
application.gtk.gdk.VISUAL_STATIC_COLOREach pixel value is an index into a predefined,
unmodifiable color map that maps pixel values into RGB values.gtk.gdk.VISUAL_PSEUDO_COLOREach pixel is an index into a color map that maps pixel
values into rgb values. The color map can be changed by an
application.gtk.gdk.VISUAL_TRUE_COLOREach pixel value directly contains red, green, and blue
components. The red_mask, green_mask, and blue_mask fields of the gtk.gdk.Visual
structure describe how the components are assembled into a pixel
value.gtk.gdk.VISUAL_DIRECT_COLOREach pixel value contains red, green, and blue
components as for gtk.gdk.TRUE_COLOR, but the components
are mapped via a color table into the final output table instead of being
converted directly. gtk.gdk.visual_get_systemgtk.gdk.visual_get_systemReturns :the system gtk.gdk.VisualThe gtk.gdk.visual_get_system() function
returns the default gtk.gdk.Visual for
the system's default screen.gtk.gdk.query_depthsgtk.gdk.query_depthsReturns :a tuple containing the unique supported
visual depthsThis function is available in PyGTK 2.4 and above.The gtk.gdk.query_depths() function returns
a tuple containing the unique supported visual depths for the default
screen. It's equivalent to listing the visuals (see the gtk.gdk.list_visuals()
function) and then looking at the depth field in each visual, removing
duplicates.gtk.gdk.query_visual_typesgtk.gdk.query_visual_typesReturns :the system gtk.gdk.VisualThe gtk.gdk.query_visual_types() function
returns a tuple containing the unique visual types supported by the default
screen.It's equivalent to listing the visuals (see the gtk.gdk.list_visuals()
function) and then looking at the type field in each visual, removing
duplicates.The returned value will be one of:gtk.gdk.VISUAL_STATIC_GRAYEach pixel value indexes a grayscale value
directly.gtk.gdk.VISUAL_GRAYSCALEEach pixel is an index into a color map that maps pixel
values into grayscale values. The color map can be changed by an
application.gtk.gdk.VISUAL_STATIC_COLOREach pixel value is an index into a predefined,
unmodifiable color map that maps pixel values into RGB
values.gtk.gdk.VISUAL_PSEUDO_COLOREach pixel is an index into a color map that maps pixel
values into rgb values. The color map can be changed by an
application.gtk.gdk.VISUAL_TRUE_COLOREach pixel value directly contains red, green, and blue
components. The red_mask, green_mask, and blue_mask fields of
the gtk.gdk.Visual
structure describe how the components are assembled into a pixel
value.gtk.gdk.VISUAL_DIRECT_COLOREach pixel value contains red, green, and blue
components as for gtk.gdk.VISUAL_TRUE_COLOR,
but the components are mapped via a color table into the final
output table instead of being converted directly.