[core/popup_v2] Destroy menu on leave

When mouse leaves the menu, destroy it.
This commit is contained in:
Tobias Witek 2019-07-03 18:52:12 +02:00
parent 682d2f47dd
commit 6deb80edda

View file

@ -20,6 +20,7 @@ class PopupMenu(object):
self._root.withdraw() self._root.withdraw()
self._menu = tk.Menu(self._root) self._menu = tk.Menu(self._root)
self._menu.bind("<FocusOut>", self._on_focus_out) self._menu.bind("<FocusOut>", self._on_focus_out)
self._menu.bind("<Leave>", self._on_focus_out)
def _on_focus_out(self, event=None): def _on_focus_out(self, event=None):
self._root.destroy() self._root.destroy()