Question

Various examples always use alloc_color() and stuff like gtk.color.parse('red'), etc. I just do gtk.gdk.Color(65535,0,0), and that seems to work. What's the need for alloc_color?

Was it helpful?

Solution

If you're running on a system that uses a palette display (as opposed to a true-colour display), then you must allocate new colours in the palette before you can use them. This is because palette-based displays can only display a limited number of colours at once (usually 256 or sometimes 65536).

Most displays these days are capable of true colour display, which can display all available colours simultaneously, so this won't appear to be a problem and you can get away with directly asking for specific colours.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top