pygobject-stubs
pygobject-stubs copied to clipboard
`Gtk.NoSelection.__init__` incorrectly typed
Gtk.NoSelection.__init__
https://github.com/pygobject/pygobject-stubs/blob/master/src/gi-stubs/repository/_Gtk4.pyi#L10709
Actual error
model=Gtk.NoSelection(Gtk.StringList.new(["A", "B", "C"])),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GObject.__init__() takes exactly 0 arguments (1 given)
Solution
Use Gtk.NoSelection.new
(very weird API bindings)
Version info
- GObject: 3.44.1
- pygobject-stubs: 2.7.0
- Gtk: 4.10.3
I think the introspection is wrong here for some reason but i cant find the error in https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtknoselection.c#L273 and idea @mat-xc
I am not sure I am following. It's correct for __init__
to take 0 arguments. It only allows kwargs arguments.
ah ok so is this true for all inits in GTK4? Is this something PyGObject enforces ? this means we could specifiy this making the init
def init(self, * , model: Gio.ListModel = ... )
We already discussed it here.
I am on mobile right now, if your solution works I thinks it is a good idea