From 9db5a764cc14088980dbae7cc03b9567b955e326 Mon Sep 17 00:00:00 2001 From: PySimpleGUI <PySimpleGUI@PySimpleGUI.com> Date: Fri, 1 Oct 2021 09:34:47 -0400 Subject: [PATCH] set_right_click_menu - if no menu specified, use the parent window's right click menu --- PySimpleGUI.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ee34773a..1944e658 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -version = __version__ = "4.49.0.1 Unreleased" +version = __version__ = "4.49.0.2 Unreleased" _change_log = """ @@ -8,6 +8,8 @@ _change_log = """ 4.49.0.1 Element.set_right_click_menu added so can set or change the right click menu for an element + 4.49.0.2 + Element.set_right_click_menu - If no menu supplied, use the parent form's right click menu """ @@ -1432,9 +1434,13 @@ class Element(): - def set_right_click_menu(self, menu): + def set_right_click_menu(self, menu=None): if menu == MENU_RIGHT_CLICK_DISABLED: return + if menu is None: + menu = self.ParentForm.RightClickMenu + if menu is None: + return if menu: top_menu = tk.Menu(self.ParentForm.TKroot, tearoff=self.ParentForm.right_click_menu_tearoff, tearoffcommand=self._tearoff_menu_callback)