From d1d48a17b27eadf46052f3fe482d2637ce398419 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Thu, 26 Sep 2019 19:46:58 -0400 Subject: [PATCH] New element method for button rebinding. Bind destination should be Element.ButtonReboundCallback. --- PySimpleGUI.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 3426ad47..00a4ebbe 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "4.5.0.20 Unreleased Mac Buttons. Element size get/set. Screen Size. hide/unhide row" +version = __version__ = "4.5.0.21 Unreleased Mac Buttons. Element size get/set. Screen Size. hide/unhide row. Button rebinding" # 888888ba .d88888b oo dP .88888. dP dP dP @@ -731,6 +731,20 @@ class Element(): if self.ParentForm.CurrentlyRunningMainloop: self.ParentForm.TKroot.quit() + def ButtonReboundCallback(self, event): + """ + Used in combination with tkinter's widget.bind function. If you wish to have a double-click for a button to call back the button's normal + callback routine, then you should target your call to tkinter's bind method to point to this function which will in turn call the button + callback function that is normally called. + + :param event: (unknown) Not used in this function. + """ + try: + self.ButtonCallBack() + except: + print('** ButtonReboundCallback - warning your element does not have a ButtonCallBack method **') + + def SetTooltip(self, tooltip_text): """ Called by application to change the tooltip text for an Element. Normally invoked using the Element Object such as: window.Element('key').SetToolTip('New tip').