MCPcopy Index your code
hub / github.com/python/cpython / bind

Method bind

Lib/tkinter/__init__.py:1524–1563  ·  view source on GitHub ↗

Bind to this widget at event SEQUENCE a call to function FUNC. SEQUENCE is a string of concatenated event patterns. An event pattern is of the form where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Bu

(self, sequence=None, func=None, add=None)

Source from the content-addressed store, hash-verified

1522 return self.tk.splitlist(self.tk.call(what))
1523
1524 def bind(self, sequence=None, func=None, add=None):
1525 """Bind to this widget at event SEQUENCE a call to function FUNC.
1526
1527 SEQUENCE is a string of concatenated event
1528 patterns. An event pattern is of the form
1529 <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
1530 of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
1531 Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
1532 B3, Alt, Button4, B4, Double, Button5, B5 Triple,
1533 Mod1, M1. TYPE is one of Activate, Enter, Map,
1534 ButtonPress, Button, Expose, Motion, ButtonRelease
1535 FocusIn, MouseWheel, Circulate, FocusOut, Property,
1536 Colormap, Gravity Reparent, Configure, KeyPress, Key,
1537 Unmap, Deactivate, KeyRelease Visibility, Destroy,
1538 Leave and DETAIL is the button number for ButtonPress,
1539 ButtonRelease and DETAIL is the Keysym for KeyPress and
1540 KeyRelease. Examples are
1541 <Control-Button-1> for pressing Control and mouse button 1 or
1542 <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
1543 An event pattern can also be a virtual event of the form
1544 <<AString>> where AString can be arbitrary. This
1545 event can be generated by event_generate().
1546 If events are concatenated they must appear shortly
1547 after each other.
1548
1549 FUNC will be called if the event sequence occurs with an
1550 instance of Event as argument. If the return value of FUNC is
1551 "break" no further bound function is invoked.
1552
1553 An additional boolean parameter ADD specifies whether FUNC will
1554 be called additionally to the other bound function or whether
1555 it will replace the previous function.
1556
1557 Bind will return an identifier to allow deletion of the bound function with
1558 unbind without memory leak.
1559
1560 If FUNC or SEQUENCE is omitted the bound function or list
1561 of bound events are returned."""
1562
1563 return self._bind(('bind', self._w), sequence, func, add)
1564
1565 def unbind(self, sequence, funcid=None):
1566 """Unbind for this widget the event SEQUENCE.

Callers 15

__init__Method · 0.45
attachMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
buttonboxMethod · 0.45
__init__Method · 0.45
create_unix_serverMethod · 0.45
_connect_sockMethod · 0.45
create_serverMethod · 0.45
_run_with_syncFunction · 0.45
d3.min.jsFile · 0.45

Calls 1

_bindMethod · 0.95

Tested by

no test coverage detected