[pygtk] no invisible cursor

Ionutz Borcoman borco at go.ro
Mon Feb 28 23:08:31 WST 2005

Ross Burton wrote:
> On Mon, 2005-02-28 at 14:45 +0100, Le Boulanger Yann wrote:
>>I think the doc suggests you to use an empty pixbuf, not to run 
>>gtk.gdk.Cursors() without arguments.
>>Maybe i'm wrong :/
> That is correct.
> By "gtk.gdk.Cursor()" the documentation meant "one of the valid
> gtk.gdk.Cursor constructors with an empty cursor".  This could probably
> be phrased better.
> Ross

I have try this:

def create_empty_cursor(window):
   pix_data = """#define invisible_cursor_width 0
#define invisible_cursor_height 0
#define invisible_cursor_x_hot 0
#define invisible_cursor_y_hot 0
static unsigned short invisible_cursor_bits[] = {};"""

   color = gtk.gdk.Color()
   pix = gtk.gdk.bitmap_create_from_data(window, pix_data, 1, 1)
   return gtk.gdk.Cursor(pix, pix, color, color, 0, 0)

The problem is that I still get a black dot. I want nothing, not event 
that dot. (I have try to set the pix to have size 0x0, but it crashes 
the whole app).

I believe hiding the cursor is a common enough operation - there should 
be some shorcut for doing it. I though that gtkgdk.Cursor *with no 
arguments* is the way to do it. It looks now, it isn't :(

So, how do I hide the cursor?


Ionutz Borcoman


More information about the pygtk mailing list