Create Flap in GTK 4 with PyGObject, Libadwaita
I know this is not the right place for this but I've tried SO and Reddit but no response.
I'm trying to create a Flap in Libadwaita using PyGObject but I only get an empty window.
My code looks like this:
import gi
gi.require_version(namespace='Gtk', version='4.0')
gi.require_version(namespace='Adw', version='1')
from gi.repository import Gio, Gtk
from gi.repository import Adw
class MainWindow(Gtk.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.set_title(title='Python and GTK 4 Adwaita: PyGObject Adw.Flap')
box = Gtk.Box()
self.set_child(child=box)
adw_flap = Adw.Flap.new()
self.set_child(child=adw_flap)
class Application(Gtk.Application):
def __init__(self):
super().__init__(application_id='adw.flap.demo',
flags=Gio.ApplicationFlags.FLAGS_NONE)
def do_startup(self):
Gtk.Application.do_startup(self)
def do_activate(self):
win = self.props.active_window
if not win:
win = MainWindow(application=self)
win.present()
def do_shutdown(self):
Gtk.Application.do_shutdown(self)
if __name__ == '__main__':
import sys
app = Application()
app.run(sys.argv)
I'm creating a GTK window with a box inside (do I need to create the box or can I place the flap directly inside the GTK window?) and inside the box I'm trying to create the flap. Where am I going wrong in my code?