0

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")
Fred
  • 12,086
  • 7
  • 60
  • 83

1 Answers1

0

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)
Fred
  • 12,086
  • 7
  • 60
  • 83