MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / bind

Method bind

tools/python-3.11.9-amd64/Lib/tkinter/__init__.py:1411–1450  ·  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,

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

Source from the content-addressed store, hash-verified

1409 return self.tk.splitlist(self.tk.call(what))
1410
1411 def bind(self, sequence=None, func=None, add=None):
1412 """Bind to this widget at event SEQUENCE a call to function FUNC.
1413
1414 SEQUENCE is a string of concatenated event
1415 patterns. An event pattern is of the form
1416 <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one
1417 of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4,
1418 Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3,
1419 B3, Alt, Button4, B4, Double, Button5, B5 Triple,
1420 Mod1, M1. TYPE is one of Activate, Enter, Map,
1421 ButtonPress, Button, Expose, Motion, ButtonRelease
1422 FocusIn, MouseWheel, Circulate, FocusOut, Property,
1423 Colormap, Gravity Reparent, Configure, KeyPress, Key,
1424 Unmap, Deactivate, KeyRelease Visibility, Destroy,
1425 Leave and DETAIL is the button number for ButtonPress,
1426 ButtonRelease and DETAIL is the Keysym for KeyPress and
1427 KeyRelease. Examples are
1428 <Control-Button-1> for pressing Control and mouse button 1 or
1429 <Alt-A> for pressing A and the Alt key (KeyPress can be omitted).
1430 An event pattern can also be a virtual event of the form
1431 <<AString>> where AString can be arbitrary. This
1432 event can be generated by event_generate.
1433 If events are concatenated they must appear shortly
1434 after each other.
1435
1436 FUNC will be called if the event sequence occurs with an
1437 instance of Event as argument. If the return value of FUNC is
1438 "break" no further bound function is invoked.
1439
1440 An additional boolean parameter ADD specifies whether FUNC will
1441 be called additionally to the other bound function or whether
1442 it will replace the previous function.
1443
1444 Bind will return an identifier to allow deletion of the bound function with
1445 unbind without memory leak.
1446
1447 If FUNC or SEQUENCE is omitted the bound function or list
1448 of bound events are returned."""
1449
1450 return self._bind(('bind', self._w), sequence, func, add)
1451
1452 def unbind(self, sequence, funcid=None):
1453 """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
test_bindMethod · 0.45
test_unbindMethod · 0.45
test_unbind2Method · 0.45
test_bind_rebindMethod · 0.45
test_bind_eventsMethod · 0.45
test_virtual_eventMethod · 0.45

Calls 1

_bindMethod · 0.95

Tested by 8

test_bindMethod · 0.36
test_unbindMethod · 0.36
test_unbind2Method · 0.36
test_bind_rebindMethod · 0.36
test_bind_eventsMethod · 0.36
test_virtual_eventMethod · 0.36
test_custom_eventMethod · 0.36
test_selectMethod · 0.36