Python - wrong result with GTK menu only on Manjaro Gnome

Hello,
I have a problem on my Python program but it seems that it’s a problem around Manjaro Gnome. It’s important to know that my program was wright since a long time.
In this post (in french but it’s easy to understand with the screen captures), I have resumed the problem:

  • my program in Python3 use GTK v3. The program in the post is only a short example.
  • if I run it on Manjaro KDE last version, Ubuntu 21.10 with Gnome 40.2.0, Pop!OS Gnome or Mint Cinnamon, no problem.
  • but if I run it on Manjaro Gnome 40.2 or 40.3, with my PC or on a live USB with fresh install, the result is wrong as you can see in the second and third pictures.
    The Gnome version with neofetch is 40.3 (but the problem was the same with Fbome 38.4).
    The Gnome version with “parameters - about” is 40.2.0.

Any idea ? Thanks in advance
PS: I have applied a correction of my program with using XML method but I would like to uderstand this error.

Source code?

I tried your test Python script on the forum post, but it doesn’t run.

❯ python ~/MyApplication.py
  File "/home/yochanan/MyApplication.py", line 2
    try :
IndentationError: unexpected indent

I have copied the source code in a file with nano.
I have run it, no problem.
The TAB characters must respect Python syntax.
Cheers

No idea what that means. The formatting on that forum must ruin it.

No one can help if we can’t reproduce the issue.

you use in code set_app_menu(), for me all is good but you want a bar, its set_menubar()

https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Application.html#Gtk.Application.set_app_menu

Thanks for your answers.
The same post in french forum received an answer: Gnome on Manjaro seems to integrate the menu in system bar. If I use the set_menubar with XML file, I have a traditional menu design, if I use set_app_menu, it’s integrated in system bar. (1)
And my specific theme (Nordic - not a standard theme) dont integrate this new feature.
I must use a standard theme or update mine.
If somebody had a reference for this new design, it will help me.
Thanks to evrybody.
(1) it’s specific for Manjaro Gnome, I can’t reproduce it on Ubuntu 21.10 Gnome 40.

I confirm. It’s a theme issue.
The theme (Nordic) is distributed via gnome-look.org. I have created a issue ticket dor this problem.
It was not a Python or Manjaro or Gnome problem, only the new feature of Manjaro to integrate the Menu icon in top bar.
I Close. Thanks.

That’s not a Manjaro feature.

Exactly.

Gnome 40 uses GTK4, you are using GTK3, I don’t think python bindings are available yet for GTK4.

if you want test gtk4, you can

pacman -F Gtk-4.0.typelib
extra/gtk4     1:4.2.1-2
    usr/lib/girepository-1.0/Gtk-4.0.typelib

At you to change our code source

gi.require_version('Gtk', '4.0')

but api gtk4 is not exactly the same as gtk3 (show_all(), toolbar not exists, …) - so source code for 4 is not valid for 3

https://developer.gnome.org/gtk4/stable/gtk-migrating-3-to-4.html


gtk3 gtk_application_set_app_menu () not exists with gtk4 :wink: now we have only gtk-application-set-menubar()