1.

How Does The Alloc() Method To The Gdkcolormap Work?

Answer»

gdk.Colormap.alloc_color can TAKE a number of formats:

 cmap = widget.get_colormap()
 color = cmap.alloc_color("#FFCCAA")
 color = cmap.alloc_color("red")
 color = cmap.alloc_color(0, 0, 65535)

Note that the third FORMAT uses a tuple to specify the individual values for Red, GREEN and Blue (RGB), each item being an integer from 0 to 65535 (corresponding, therefore, to 0x0-0xFF).

gdk.Colormap.alloc_color can take a number of formats:

 cmap = widget.get_colormap()
 color = cmap.alloc_color("#FFCCAA")
 color = cmap.alloc_color("red")
 color = cmap.alloc_color(0, 0, 65535)

Note that the third format uses a tuple to specify the individual values for Red, Green and Blue (RGB), each item being an integer from 0 to 65535 (corresponding, therefore, to 0x0-0xFF).



Discussion

No Comment Found