Internal function.
(self, *args)
| 1620 | _subst_format_str = " ".join(_subst_format) |
| 1621 | |
| 1622 | def _substitute(self, *args): |
| 1623 | """Internal function.""" |
| 1624 | if len(args) != len(self._subst_format): return args |
| 1625 | getboolean = self.tk.getboolean |
| 1626 | |
| 1627 | getint = self.tk.getint |
| 1628 | def getint_event(s): |
| 1629 | """Tk changed behavior in 8.4.2, returning "??" rather more often.""" |
| 1630 | try: |
| 1631 | return getint(s) |
| 1632 | except (ValueError, TclError): |
| 1633 | return s |
| 1634 | |
| 1635 | nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args |
| 1636 | # Missing: (a, c, d, m, o, v, B, R) |
| 1637 | e = Event() |
| 1638 | # serial field: valid for all events |
| 1639 | # number of button: ButtonPress and ButtonRelease events only |
| 1640 | # height field: Configure, ConfigureRequest, Create, |
| 1641 | # ResizeRequest, and Expose events only |
| 1642 | # keycode field: KeyPress and KeyRelease events only |
| 1643 | # time field: "valid for events that contain a time field" |
| 1644 | # width field: Configure, ConfigureRequest, Create, ResizeRequest, |
| 1645 | # and Expose events only |
| 1646 | # x field: "valid for events that contain an x field" |
| 1647 | # y field: "valid for events that contain a y field" |
| 1648 | # keysym as decimal: KeyPress and KeyRelease events only |
| 1649 | # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress, |
| 1650 | # KeyRelease, and Motion events |
| 1651 | e.serial = getint(nsign) |
| 1652 | e.num = getint_event(b) |
| 1653 | try: e.focus = getboolean(f) |
| 1654 | except TclError: pass |
| 1655 | e.height = getint_event(h) |
| 1656 | e.keycode = getint_event(k) |
| 1657 | e.state = getint_event(s) |
| 1658 | e.time = getint_event(t) |
| 1659 | e.width = getint_event(w) |
| 1660 | e.x = getint_event(x) |
| 1661 | e.y = getint_event(y) |
| 1662 | e.char = A |
| 1663 | try: e.send_event = getboolean(E) |
| 1664 | except TclError: pass |
| 1665 | e.keysym = K |
| 1666 | e.keysym_num = getint_event(N) |
| 1667 | try: |
| 1668 | e.type = EventType(T) |
| 1669 | except ValueError: |
| 1670 | e.type = T |
| 1671 | try: |
| 1672 | e.widget = self._nametowidget(W) |
| 1673 | except KeyError: |
| 1674 | e.widget = W |
| 1675 | e.x_root = getint_event(X) |
| 1676 | e.y_root = getint_event(Y) |
| 1677 | try: |
| 1678 | e.delta = getint(D) |
| 1679 | except (ValueError, TclError): |
nothing calls this directly
no test coverage detected