ousia
(Pablo Rodríguez)
January 18, 2023, 3:22pm
1
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:
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.
ebassi
(Emmanuele Bassi)
January 18, 2023, 3:29pm
2
You are importing libadwaita, and not using it.
Replace the Gtk.Application
instance with Adw.Application
:
1 Like
alicem
(Alice Mikhaylenko)
January 18, 2023, 3:47pm
3
Also even if it was used - the code creates an empty window, so… you get an empty window. What else would it be?
ousia
(Pablo Rodríguez)
January 18, 2023, 3:51pm
4
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.
ousia
(Pablo Rodríguez)
January 18, 2023, 3:53pm
5
@alicem ,
styling such as in (from where I copied the code):
Many thanks for your help.
alicem
(Alice Mikhaylenko)
January 18, 2023, 4:06pm
6
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.
ousia
(Pablo Rodríguez)
January 18, 2023, 5:06pm
7
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.
system
(system)
Closed
February 17, 2023, 5:06pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.