FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 4.8 | Next Entry >>

4.8. How does the alloc() method to the GdkColormap work?

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).

Complete reference documentation on GdkColormap is available at [pygtk.org]

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org