Search code examples
pythongtk3pygobject

pyGObject transparent cursor


How can I get a transparent cursor using Python GTK3 and pyGObject. I have search the internet high and low but can not find anthing. I have found a lot of example using pixmap but I believe pyGObject doesn't have pixmap. I can't seem to find any documentation on what replaces pixmap. Help I'm stuck.

Thanks Sam


Solution

  • This is the easiest solution to get a transparent cursor:

    from gi.repository import Gtk, Gdk
    
    win = Gtk.Window(title="Hello World")
    win.show_all()
    cursor = Gdk.Cursor.new(Gdk.CursorType.BLANK_CURSOR)
    win.get_window().set_cursor(cursor)
    Gtk.main()