Comment 3 for bug 2054197

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I can't reproduce this exact error, but I do get an error if the Gdk imported is version 4:

>>> from gi.repository import Gdk
<stdin>:1: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '4.0') before import to ensure that the right version gets loaded.
>>> Gdk.Cursor.new(Gdk.CursorType.WATCH)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'Cursor' has no attribute 'new'. Did you mean: 'newv'?

After all the new constructor only exists in Gdk 3.

I see two possible solutions:

1. Do as suggested and require the specific Gdk version with
   gi.require_version('Gdk', '3.0')

2. Use a constructor that exists in both Gdk versions:
   Gdk.Cursor.new_from_name("wait", None)