Used when user binds a tkinter event directly to an element :param bind_string: The event that was bound so can lookup the key modifier :type bind_string: (str) :param event: Event data passed in by tkinter (not used) :type event: (Any)
(self, bind_string, event, propagate=True)
| 1422 | return True |
| 1423 | |
| 1424 | def _user_bind_callback(self, bind_string, event, propagate=True): |
| 1425 | """ |
| 1426 | Used when user binds a tkinter event directly to an element |
| 1427 | |
| 1428 | :param bind_string: The event that was bound so can lookup the key modifier |
| 1429 | :type bind_string: (str) |
| 1430 | :param event: Event data passed in by tkinter (not used) |
| 1431 | :type event: (Any) |
| 1432 | :param propagate: If True then tkinter will be told to propagate the event to the element |
| 1433 | :type propagate: (bool) |
| 1434 | """ |
| 1435 | key_suffix = self.user_bind_dict.get(bind_string, '') |
| 1436 | self.user_bind_event = event |
| 1437 | if self.Type == ELEM_TYPE_GRAPH: |
| 1438 | self._update_position_for_returned_values(event) |
| 1439 | if self.Key is not None: |
| 1440 | if isinstance(self.Key, str): |
| 1441 | key = self.Key + str(key_suffix) |
| 1442 | else: |
| 1443 | key = (self.Key, key_suffix) # old way (pre 2021) was to make a brand new tuple |
| 1444 | # key = self.Key + (key_suffix,) # in 2021 tried this. It will break existing applications though - if key is a tuple, add one more item |
| 1445 | else: |
| 1446 | key = bind_string |
| 1447 | |
| 1448 | self._generic_callback_handler(force_key_to_be=key) |
| 1449 | |
| 1450 | return 'break' if propagate is not True else None |
| 1451 | |
| 1452 | def bind(self, bind_string, key_modifier, propagate=True): |
| 1453 | """ |
no test coverage detected