I've been trying to change the cursor on Gtk.ScrolledWindow() (it has an image widget in it) mouseover:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GdkPixbuf
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title = "Test")
self.maximize()
grid = Gtk.Grid()
self.add(grid)
scrolled = Gtk.ScrolledWindow()
scrolled.set_hexpand(True)
scrolled.set_vexpand(True)
scrolled.connect("motion-notify-event", self.mousemove)
grid.add(scrolled)
pixbuf = GdkPixbuf.Pixbuf.new_from_file("anyimage.jpg")
image = Gtk.Image.new_from_pixbuf(pixbuf)
scrolled.add(image)
def mousemove(self, widget, event):
print("Mouseover triggered")
circle = Gdk.Cursor(Gdk.CursorType.CIRCLE)
widget.get_window().set_cursor(circle)
win = MainWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
The event is triggered but instead of a circle the cursor is displayed as an arrow with a "disabled" symbol as its subscript.
Am I missing something here?
I was wrong, it's not a bug. It's entirely up to the cursor theme in use. I was recommended to stick to cursors listed by name here:
https://developer.gnome.org/gdk3/3.24/gdk3-Cursors.html#gdk-cursor-new-from-name
Those correspond to CSS and are most likely to be available across cursor themes.