From 9c48c5ba63ead0e5c4b97e974583510cfc5bbe24 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Fri, 21 Dec 2018 11:06:01 -0500 Subject: [PATCH] ButtonMenu - made return values same as PySimpleGUIQt --- PySimpleGUI.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 556e2a67..f0a434a0 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1631,8 +1631,8 @@ class ButtonMenu(Element): def MenuItemChosenCallback(self, item_chosen): # print('IN MENU ITEM CALLBACK', item_chosen) - self.MenuItemChosen = item_chosen - self.ParentForm.LastButtonClicked = item_chosen + self.MenuItemChosen = item_chosen.replace('&','') + self.ParentForm.LastButtonClicked = self.Key self.ParentForm.FormRemainedOpen = True if self.ParentForm.CurrentlyRunningMainloop: self.ParentForm.TKroot.quit() # kick the users out of the mainloop @@ -4203,10 +4203,13 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): value = element.MenuItemChosen element.MenuItemChosen = None elif element.Type == ELEM_TYPE_BUTTONMENU: - if element.MenuItemChosen is not None: - button_pressed_text = top_level_form.LastButtonClicked = element.MenuItemChosen value = element.MenuItemChosen element.MenuItemChosen = None + + # if element.MenuItemChosen is not None: + # button_pressed_text = top_level_form.LastButtonClicked = element.MenuItemChosen + # value = element.MenuItemChosen + # element.MenuItemChosen = None else: value = None