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)
| 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 | """ |
nothing calls this directly
no test coverage detected