Libadwaita not working

Dear people,

I have the following minimal sample:

import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw

def on_activate(app):
    win = Gtk.ApplicationWindow(application=app)
    win.set_title("χαλεπὰ τὰ καλά")
    win.present()

app = Gtk.Application()
app.connect('activate', on_activate)

app.run(None)

I‘m on Fedora 37 LXDE (with all packages installed from the package list I had in Fedora 35 LXDE).

Although Adwaita was explicitly requested, all I get is:

wrong-adwaita

I think that there is an extra dependency that is preventing libadwaita from working at all.

Does anyone know which dependency (or which kind of dependency) may be triggering this deactivation?

Many thanks for your help.

You are importing libadwaita, and not using it.

Replace the Gtk.Application instance with Adw.Application:

1 Like

Also even if it was used - the code creates an empty window, so… you get an empty window. What else would it be?

Many thanks for your fast reply, @ebassi.

I get the same result:

From the modified code:

import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw

def on_activate(app):
    win = Gtk.ApplicationWindow(application=app)
    win.set_title("χαλεπὰ τὰ καλά")
    win.present()

app = Adw.Application()
app.connect('activate', on_activate)

app.run(None)

BTW, each time I run the script, a file __pycache__/cairo.cpython-311.pyc is generated on the same directory (this happened before modifying the file).

What am I missing here?

Many thanks for your help.

@alicem,

styling such as in (from where I copied the code):

Many thanks for your help.

I mean since you don’t have a custom titlebar and aren’t running it on Wayland the titlebar is drawn by your window manager.

The second screenshot is just it running on GNOME instead (and that’s not libadwaita style, no).

If you set a custom titlebar, it will use that instead.

Many thanks for your replies and sorry for the noise, @ebassi & @alicem.

I totally misunderstood how libadwaita works and now I see that Gtk.HeaderBar() is what I was looking for.

In any case, something has to be wrong on my system, since __pycache__/cairo.cpython-311.pyc shouldn’t be generated when the script is executed.

Many thanks for your help again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.