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)
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 version( 'Gdk', '4.0') before import to ensure that the right version gets loaded. new(Gdk. CursorType. WATCH)
<stdin>:1: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_
>>> Gdk.Cursor.
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 version( 'Gdk', '3.0')
gi.require_
2. Use a constructor that exists in both Gdk versions: Cursor. new_from_ name("wait" , None)
Gdk.