I am trying to show a calendar from a context menu. At first, I included it as a 'Gtk.MenuItem', but after reading http://stackoverflow.com/questions/11132929/showing-a-gtk-calendar-in-a-menu
answer, I am now showing the calendar as a popup window when the user hovers over a menu item.
When the user hovers over 'Set due date', the calendar is supposed to show up right beside it. It is shown when 'activate' signal ( 'on_set_due_via_calendar' ) fires from the 'Set due date' menu item. Here's the code for it -
def on_set_due_via_calendar(self, widget):
rect = widget.get_allocation()
x, y = widget.window.get_origin()
menu_width, menu_height = widget.get_toplevel().window.get_size()
calendar_width, calendar_height = self.calendar.get_size()
self.calendar.show_at_position(x + rect.x + calendar_width + menu_width,
y + rect.y + calendar_height)
The problem I'm facing is that the menu disappears as soon as the window is shown ( Perhaps it works that way ). I want it to keep getting displayed until the user clicks somewhere else ( i.e. - Treat the calendar as a submenu ).
Here are the screens showing the issue -