New element method for button rebinding. Bind destination should be Element.ButtonReboundCallback.

This commit is contained in:
PySimpleGUI 2019-09-26 19:46:58 -04:00
parent f1b5aa29d3
commit d1d48a17b2
1 changed files with 15 additions and 1 deletions

View File

@ -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').