Display of menu

The documentation Making an application menu states, “Application menus are in the process of being phased out”

Is there a Python example of the new primary menu? I have a GTK application with a headerbar with two buttons, but my menu is not showing when I set the headerbar. It used to show at the top of the GNOME Shell with Ubuntu 18.10 but not with 19.04.

How do ther GTK applications cram everything into the headerbar? For example, gedit has: open, new tab, save, and the hamburger menu. Can I get a menu widget from Gtk Builder?

As there is still no reply from a core dev:

A useful source for menu creation and gactions may be

https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5

You can see a picture with menu on the bottom of that page. Well it is C not python, but you should get the idea. I followed that page three years ago to make an editor in Nim, can not remember details currently.

And maybe also

https://wiki.gnome.org/HowDoI

Another source is gtkDcoding.com. There’s a whole series on menus starting with the basics and carrying on for nine blog entries.

For Linux, I did basically this and styled it with an icon.

builder = Gtk.Builder()
builder.add_from_file(app_menu_filename)
menu_button.set_menu_model(builder.get_object('app-menu'))
headerbar.pack_end(menu_button)

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