Hi, I'm trying to set a customised cursor for a drawing application. I want the 
cursor to 
reflect the size and color of the selected pen.

   pm=gtk.gdk.Pixmap(page.canvas.window,10,10,1)
   gc = pm.new_gc(foreground=gtk.gdk.color_parse('black'))
   pm.draw_rectangle(gc, True, 0, 0, 9, 9)

   mask=gtk.gdk.Pixmap(page.canvas.window,10,10,1)
   gc = mask.new_gc(foreground = gtk.gdk.color_parse('white'))
   mask.draw_rectangle(gc, False, 0, 0, 9, 9)

   cur=gtk.gdk.Cursor(pm, mask,  gtk.gdk.color_parse('white'), 
gtk.gdk.color_parse('black'), 5, 5)
   page.canvas.window.set_cursor(cur)


What I get is a whole lot of random garbage in a square roughly the right size. 
If I set the depth 
of pm to -1, I get an X error ('BadMatch (invalid parameter attributes)') and 
the program crashes.

Could anyone give me some pointers to fix this?

Also, I'm not very clear on the role's of the fg and bg in the Cursor 
contructor, the documentation
is not very illuminating:

  fg : the unallocated foreground gtk.gdk.Color
  bg : the unallocated background gtk.gdk.Color

'unallocated' ??


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/

Reply via email to