[util/popup] add generic "close" on root menu

add a "close" entry for the root menu of all popup menus (if they are
not automatically destroyed when leaving the menu).

fixes #633
This commit is contained in:
tobi-wan-kenobi 2020-05-30 15:18:40 +02:00
parent cb13fbf917
commit 55121c86d4

View file

@ -22,6 +22,9 @@ class menu(object):
self._root.withdraw() self._root.withdraw()
self._menu = tk.Menu(self._root, tearoff=0) self._menu = tk.Menu(self._root, tearoff=0)
self._menu.bind("<FocusOut>", self.__on_focus_out) self._menu.bind("<FocusOut>", self.__on_focus_out)
self.add_menuitem("close", self.__on_focus_out)
self.add_separator()
else: else:
self._root = parent.root() self._root = parent.root()
self._root.withdraw() self._root.withdraw()