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

Method bind

PySimpleGUI/PySimpleGUI.py:12026–12045  ·  view source on GitHub ↗

Used to add tkinter events to a Window. The tkinter specific data is in the Window's member variable user_bind_event :param bind_string: The string tkinter expected in its bind function :type bind_string: (str) :param key: The event that will be gene

(self, bind_string, key, propagate=True)

Source from the content-addressed store, hash-verified

12024 return 'break' if propagate is not True else None
12025
12026 def bind(self, bind_string, key, propagate=True):
12027 """
12028 Used to add tkinter events to a Window.
12029 The tkinter specific data is in the Window's member variable user_bind_event
12030 :param bind_string: The string tkinter expected in its bind function
12031 :type bind_string: (str)
12032 :param key: The event that will be generated when the tkinter event occurs
12033 :type key: str | int | tuple | object
12034 :param propagate: If True then tkinter will be told to propagate the event
12035 :type propagate: (bool)
12036 """
12037 if not self._is_window_created('tried Window.bind'):
12038 return
12039 try:
12040 self.TKroot.bind(bind_string, lambda evt: self._user_bind_callback(bind_string, evt, propagate))
12041 except Exception as e:
12042 self.TKroot.unbind_all(bind_string)
12043 return
12044 # _error_popup_with_traceback('Window.bind error', e)
12045 self.user_bind_dict[bind_string] = key
12046
12047 def unbind(self, bind_string):
12048 """

Callers 15

minimize_main_windowFunction · 0.95
make_windowFunction · 0.95
mainFunction · 0.95
dummy_minimized_windowFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
make_windowFunction · 0.95
dummy_minimized_windowFunction · 0.95
do_bindsFunction · 0.45
Demo_Hotkey.pyFile · 0.45
mainFunction · 0.45

Calls 2

_is_window_createdMethod · 0.95
_user_bind_callbackMethod · 0.95

Tested by

no test coverage detected