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

Class Event

Lib/tkinter/__init__.py:217–302  ·  view source on GitHub ↗

Container for the properties of an event. Instances of this type are generated if one of the following events occurs: KeyPress, KeyRelease - for keyboard events ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events Visibility, Unmap, Map, Expose, FocusIn,

Source from the content-addressed store, hash-verified

215
216
217class Event:
218 """Container for the properties of an event.
219
220 Instances of this type are generated if one of the following events occurs:
221
222 KeyPress, KeyRelease - for keyboard events
223 ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events
224 Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate,
225 Colormap, Gravity, Reparent, Property, Destroy, Activate,
226 Deactivate - for window events.
227
228 If a callback function for one of these events is registered
229 using bind, bind_all, bind_class, or tag_bind, the callback is
230 called with an Event as first argument. It will have the
231 following attributes (in braces are the event types for which
232 the attribute is valid):
233
234 serial - serial number of event
235 num - mouse button pressed (ButtonPress, ButtonRelease)
236 focus - whether the window has the focus (Enter, Leave)
237 height - height of the exposed window (Configure, Expose)
238 width - width of the exposed window (Configure, Expose)
239 keycode - keycode of the pressed key (KeyPress, KeyRelease)
240 state - state of the event as a number (ButtonPress, ButtonRelease,
241 Enter, KeyPress, KeyRelease,
242 Leave, Motion)
243 state - state as a string (Visibility)
244 time - when the event occurred
245 x - x-position of the mouse
246 y - y-position of the mouse
247 x_root - x-position of the mouse on the screen
248 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
249 y_root - y-position of the mouse on the screen
250 (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion)
251 char - pressed character (KeyPress, KeyRelease)
252 send_event - see X/Windows documentation
253 keysym - keysym of the event as a string (KeyPress, KeyRelease)
254 keysym_num - keysym of the event as a number (KeyPress, KeyRelease)
255 type - type of the event as a number
256 widget - widget in which the event occurred
257 delta - delta of wheel movement (MouseWheel)
258 detail - certain fixed strings (see Tcl/Tk documentation)
259 (Enter, Leave, FocusIn, FocusOut, ConfigureRequest)
260 user_data - data string which was passed to event_generate() or empty
261 string (VirtualEvent)
262 """
263
264 def __repr__(self):
265 attrs = {k: v for k, v in self.__dict__.items() if v != '??'}
266 if not self.char:
267 del attrs['char']
268 elif self.char != '??':
269 attrs['char'] = repr(self.char)
270 if not getattr(self, 'send_event', True):
271 del attrs['send_event']
272 if self.state == 0:
273 del attrs['state']
274 elif isinstance(self.state, int):

Callers 1

_substituteMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…