MCPcopy Index your code
hub / github.com/RustPython/RustPython / Event

Class Event

Lib/tkinter/__init__.py:217–296  ·  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 """
259
260 def __repr__(self):
261 attrs = {k: v for k, v in self.__dict__.items() if v != '??'}
262 if not self.char:
263 del attrs['char']
264 elif self.char != '??':
265 attrs['char'] = repr(self.char)
266 if not getattr(self, 'send_event', True):
267 del attrs['send_event']
268 if self.state == 0:
269 del attrs['state']
270 elif isinstance(self.state, int):
271 state = self.state
272 mods = ('Shift', 'Lock', 'Control',
273 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5',
274 'Button1', 'Button2', 'Button3', 'Button4', 'Button5')

Callers 1

_substituteMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected