I'm using GTK 3.4 with python (with GObject introspection).
I have pop-up menu build with Gtk.UIManager, some menu items are not active/visible when menu is instantiated. Later they are activated and they became visible in the menu.
However there is one small issue - the size one pop-up menu (height) seems to remain same - and I have to scroll though menu items now - on top and bottom of menu area there are ^ v arrows to show that items do not fit area and that it is possible to scroll up and down. However I would very much prefer if size of pop-up just changes when it is shown.
Popup is instantiated once on app. object like this:
menu_manager=Gtk.UIManager()
menu_manager.insert_action_group(self.core_actions)
menu_manager.insert_action_group(self.power_type_actions)
menu_manager.add_ui_from_file(os.path.join(_curr_dir, 'ui', 'menus.xml'))
self.menu_manager=menu_manager
self.popup=menu_manager.get_widget('/popup')
and the shown on tray icon with this signal handler:
def show_menu(self, tray_icon, button, activate_time, user_data=None):
def pos(menu, icon):
p= Gtk.StatusIcon.position_menu(menu, icon)
return p
log.debug( 'Menu button=%s, time=%s', button, activate_time)
self.popup.popup(None, None, pos, tray_icon, button, activate_time )
Is there any way how to force menu on pop-up to resize to show all of its items without need to scroll?