GdkColor : the phantom class ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Girod

    #1

    GdkColor : the phantom class ?

    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_dat a(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 ...

  • Thomas Girod

    #2
    Re: GdkColor : the phantom class ?

    I found an answer :

    color = gtk.gdk.Color()

    and then use color for fg et bg

    Comment

    Working...