I am using Python and constructing a menu with code not decoratively using Builder XML.
menu = Gio.Menu()
menu.append("Foo", "win.foo")
# I want a separator between these two
menu.append("Bar", "win.bar")
You need to create a new section, if you don't want the section to have a name you can pass in None
.
menu = Gio.Menu()
menu.append("Foo", "win.foo")
menu_section = Gio.Menu()
menu_section.append("Bar", "win.bar")
menu.insert_section(1, None, menu_section)