I’m trying to port the basic example in https://developer.gnome.org/gtk4/unstable/gtk-getting-started.html to python. I was unable to find updated documentation for python GTK4, so it’s trial and error. The part where I’m having trouble now is window creation from app. I’ve tried all commented out variants, some more pythonic, other closer to the C implementation, to no avail. The uncommented one doesn’t raise any exception, but I’m failing to see how it is connecting the window to the app as the C example does. So one question is how to do it. But, more generally, is there a way to infer that from the GIR file or some of these things are implemented in an ad hoc way for the python module?
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk
def activate(app):
win = Gtk.ApplicationWindow()
#win = Gtk.ApplicationWindow(app)
#win = Gtk.Window(app)
#win = app.ApplicationWindow()
#win = app.Window()
#win = app.application_window()
#win = app.window()
#win = app.application_window_new()
#win = Gtk.application_window_new(app)
#win = Gtk.gtk_application_window_new(app)
win.show()
app = Gtk.Application()
app.connect("activate", activate)
app.run()