GdkColor : the phantom class ?

Thomas Girod girodt at gmail.com
Fri Apr 14 07:49:13 EDT 2006


Hi.

No matter how I try, I just can't find this GdkColor class. I'm trying
to convert some data into a pixmap in order to display it. Here is my
code :

import pygtk
pygtk.require('2.0')
import gtk
xbm = """#define dump_width 4
#define dump_height 4
static unsigned char dump_bits[] = { 0xaa, 0x6c, 0x55, 0x58, 0x4f,
0x4d, 0xb, 0x9b, 0xf8, 0xcc, 0x1d, 0xd5, 0x61, 0xa4, 0xd8, 0x78,  };"""

class Ex:
    def __init__(self):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.show()

        pixmap = gtk.gdk.pixmap_create_from_data(window.window,
##display
                                                 xbm, ##data
                                                 28,28, ##width/height
                                                 8, ##depth
                                                 fg,bg)

        image = gtk.Image()
        image.set_from_pixmap(pixmap, None)
        image.show()

    def main(self):
        gtk.main()
        return 0

e = Ex()
e.main()

------
The error comes from fg / bg. It says this have to be of type GdkColor,
but I can't find this class anywhere.

Plus, can anyone explain me the utility of those parameters, as I don't
understand the need to set a background and a foreground when you fill
every damn pixel with data ...




More information about the Python-list mailing list