>You need to use an allocated color for the gc foreground color - first get a
>colormap and then allocate the colors black and white for drawing on the
>bitmaps:
>
>w=gtk.Window()
>pm = gtk.gdk.Pixmap(None,10,10,1)
>mask = gtk.gdk.Pixmap(None,10,10,1)
>colormap = gtk.gdk.colormap_get_system()
>black = colormap.alloc_color('black')
>white = colormap.alloc_color('white')
>
>Create two GCs - one each for black and white:
>
>bgc = pm.new_gc(foreground=black)
>wgc = pm.new_gc(foreground=white)
>
>Use the black gc to clear the pixmap and mask:
>
>mask.draw_rectangle(bgc,True,0,0,10,10)
>pm.draw_rectangle(bgc,True,0,0,10,10)
>
>Use the white gc to set the bits in the pixmap and mask:
>
>pm.draw_arc(wgc,True,0,2,10,5,0,360*64)
>mask.draw_rectangle(wgc,True,0,0,10,10)
>
>Then create and set the cursor using unallocated colors:
>
>
>cur=gtk.gdk.Cursor(pm,mask,gtk.gdk,color_parse('green'),
>gtk.gdk.color_parse('red'),5,5)
>w.window.set_cursor(cur)
>
>Should have a green oval in a red background for the window cursor.
>
>John
Thanks for that, it works a treat!
Not exactly straightforward though!!
cheers,
Alexei
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/