MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / bind

Method bind

PySimpleGUI/PySimpleGUI.py:1452–1472  ·  view source on GitHub ↗

Used to add tkinter events to an Element. The tkinter specific data is in the Element's member variable user_bind_event :param bind_string: The string tkinter expected in its bind function :type bind_string: (str) :param key_modifier: Additional data to be

(self, bind_string, key_modifier, propagate=True)

Source from the content-addressed store, hash-verified

1450 return 'break' if propagate is not True else None
1451
1452 def bind(self, bind_string, key_modifier, propagate=True):
1453 """
1454 Used to add tkinter events to an Element.
1455 The tkinter specific data is in the Element's member variable user_bind_event
1456 :param bind_string: The string tkinter expected in its bind function
1457 :type bind_string: (str)
1458 :param key_modifier: Additional data to be added to the element's key when event is returned
1459 :type key_modifier: (str)
1460 :param propagate: If True then tkinter will be told to propagate the event to the element
1461 :type propagate: (bool)
1462 """
1463 if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
1464 return
1465
1466 try:
1467 self.Widget.bind(bind_string, lambda evt: self._user_bind_callback(bind_string, evt, propagate))
1468 except Exception as e:
1469 self.Widget.unbind_all(bind_string)
1470 return
1471
1472 self.user_bind_dict[bind_string] = key_modifier
1473
1474 def unbind(self, bind_string):
1475 """

Callers

nothing calls this directly

Calls 3

_widget_was_createdMethod · 0.95
_user_bind_callbackMethod · 0.95
bindMethod · 0.45

Tested by

no test coverage detected