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

Class Event

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

Source from the content-addressed store, hash-verified

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

Callers 1

_substituteMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected