File: wx.Event.txt

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (430 lines) | stat: -rw-r--r-- 13,959 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.Event:

==========================================================================================================================================
|phoenix_title|  **wx.Event**
==========================================================================================================================================

An event is a structure holding information about an event passed to a callback or member function.          

:ref:`wx.Event`  used to be a multipurpose event object, and is an abstract base class for other event classes (see below). 

For more information about events, see the :ref:`Events and Event Handling <events and event handling>`  overview. 





|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Event</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.Event_inheritance.png" alt="Inheritance diagram of Event" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Event.html" title="wx.Event" alt="" coords="7,83,90,112"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:ref:`wx.ActivateEvent`, :ref:`wx.aui.AuiManagerEvent`, :ref:`wx.adv.CalculateLayoutEvent`, :ref:`wx.CloseEvent`, :ref:`wx.CommandEvent`, :ref:`DialUpEvent`, :ref:`wx.DisplayChangedEvent`, :ref:`wx.DPIChangedEvent`, :ref:`wx.DropFilesEvent`, :ref:`wx.EraseEvent`, :ref:`wx.FileSystemWatcherEvent`, :ref:`wx.FocusEvent`, :ref:`wx.FullScreenEvent`, :ref:`wx.GestureEvent`, :ref:`wx.IconizeEvent`, :ref:`wx.IdleEvent`, :ref:`wx.InitDialogEvent`, :ref:`wx.JoystickEvent`, :ref:`wx.KeyEvent`, :ref:`wx.MaximizeEvent`, :ref:`wx.MenuEvent`, :ref:`wx.MouseCaptureChangedEvent`, :ref:`wx.MouseCaptureLostEvent`, :ref:`wx.MouseEvent`, :ref:`wx.MoveEvent`, :ref:`wx.NavigationKeyEvent`, :ref:`wx.PaintEvent`, :ref:`wx.PaletteChangedEvent`, :ref:`wx.PowerEvent`, :ref:`wx.ProcessEvent`, :ref:`wx.adv.QueryLayoutInfoEvent`, :ref:`wx.QueryNewPaletteEvent`, :ref:`wx.ScrollWinEvent`, :ref:`wx.SetCursorEvent`, :ref:`wx.ShowEvent`, :ref:`wx.SizeEvent`, :ref:`SocketEvent`, :ref:`wx.SysColourChangedEvent`, :ref:`wx.adv.TaskBarIconEvent`, :ref:`ThreadEvent`, :ref:`wx.TimerEvent`, :ref:`WebRequestEvent`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.Event.__init__`                                                       Constructor.
:meth:`~wx.Event.Clone`                                                          Returns a copy of the event.
:meth:`~wx.Event.GetEventCategory`                                               Returns a generic category for this event.
:meth:`~wx.Event.GetEventObject`                                                 Returns the object (usually a window) associated with the event, if any.
:meth:`~wx.Event.GetEventType`                                                   Returns the identifier of the given event type, such as  ``wxEVT_BUTTON`` .
:meth:`~wx.Event.GetId`                                                          Returns the identifier associated with this event, such as a button command id.
:meth:`~wx.Event.GetSkipped`                                                     Returns ``True`` if the event handler should be skipped, ``False`` otherwise.
:meth:`~wx.Event.GetTimestamp`                                                   Gets the timestamp for the event.
:meth:`~wx.Event.IsCommandEvent`                                                 Returns ``True`` if the event is or is derived from :ref:`wx.CommandEvent`  else it returns ``False``.
:meth:`~wx.Event.ResumePropagation`                                              Sets the propagation level to the given value (for example returned from an earlier call to :meth:`wx.Event.StopPropagation` ).
:meth:`~wx.Event.SetEventObject`                                                 Sets the originating object.
:meth:`~wx.Event.SetEventType`                                                   Sets the event type.
:meth:`~wx.Event.SetId`                                                          Sets the identifier associated with this event, such as a button command id.
:meth:`~wx.Event.SetTimestamp`                                                   Sets the timestamp for the event.
:meth:`~wx.Event.ShouldPropagate`                                                Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0.
:meth:`~wx.Event.Skip`                                                           This method can be used inside an event handler to control whether further event handlers bound to this event will be called after the current one returns.
:meth:`~wx.Event.StopPropagation`                                                Stop the event from propagating to its parent window.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.Event.EventObject`                                                    See :meth:`~wx.Event.GetEventObject` and :meth:`~wx.Event.SetEventObject`
:attr:`~wx.Event.EventType`                                                      See :meth:`~wx.Event.GetEventType` and :meth:`~wx.Event.SetEventType`
:attr:`~wx.Event.Id`                                                             See :meth:`~wx.Event.GetId` and :meth:`~wx.Event.SetId`
:attr:`~wx.Event.Skipped`                                                        See :meth:`~wx.Event.GetSkipped`
:attr:`~wx.Event.Timestamp`                                                      See :meth:`~wx.Event.GetTimestamp` and :meth:`~wx.Event.SetTimestamp`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.Event(Object)

   **Possible constructors**::

       Event(id=0, eventType=wxEVT_NULL)
       
   
   An event is a structure holding information about an event passed to a
   callback or member function.



   .. method:: __init__(self, id=0, eventType=wxEVT_NULL)

      Constructor.                  

      Notice that events are usually created by wxWidgets itself and creating e.g. a :ref:`wx.PaintEvent`  in your code and sending it to e.g. a :ref:`wx.TextCtrl`  will not usually affect it at all as native controls have no specific knowledge about wxWidgets events. However you may construct objects of specific types and pass them to :meth:`wx.EvtHandler.ProcessEvent`   if you want to create your own custom control and want to process its events in the same manner as the standard ones. 

      Also please notice that the order of parameters in this constructor is different from almost all the derived classes which specify the event type as the first argument. 




      :param `id`: The identifier of the object (window, timer, ...) which generated this event.   
      :type `id`: int
      :param `eventType`: The unique type of event, e.g.  ``wxEVT_PAINT`` ,   ``wxEVT_SIZE``   or   ``wxEVT_BUTTON`` .    
      :type `eventType`: wx.EventType






                  





   .. method:: Clone(self)

      Returns a copy of the event.                  

      Any event that is posted to the wxWidgets event system for later action (via :meth:`wx.EvtHandler.AddPendingEvent` , :meth:`wx.EvtHandler.QueueEvent`   or :ref:`wx.PostEvent`) must implement this method. 

      All wxWidgets events fully implement this method, but any derived events implemented by the user should also implement this method just in case they (or some event derived from them) are ever posted. 

      All wxWidgets events implement a copy constructor, so the easiest way of implementing the Clone function is to implement a copy constructor for a new event (call it MyEvent) and then define the Clone function like this: 

      ::

                  def Clone(self):

                      return MyEvent()

                 

      :rtype: :ref:`wx.Event`








   .. method:: GetEventCategory(self)

      Returns a generic category for this event.                  

      :ref:`wx.Event`  implementation returns  ``wxEVT_CATEGORY_UI``   by default. 

      This function is used to selectively process events in :meth:`wx.EventLoopBase.YieldFor` .                  

      :rtype: :ref:`wx.EventCategory`








   .. method:: GetEventObject(self)

      Returns the object (usually a window) associated with the event, if any.                  

      :rtype: :ref:`wx.Object`








   .. method:: GetEventType(self)

      Returns the identifier of the given event type, such as  ``wxEVT_BUTTON`` .                   

      :rtype: :ref:`wx.EventType`








   .. method:: GetId(self)

      Returns the identifier associated with this event, such as a button command id.                  

      :rtype: `int`








   .. method:: GetSkipped(self)

      Returns ``True`` if the event handler should be skipped, ``False`` otherwise.                  

      :rtype: `bool`








   .. method:: GetTimestamp(self)

      Gets the timestamp for the event.                  

      The timestamp is the time in milliseconds since some fixed moment (not necessarily the standard Unix Epoch, so only differences between the timestamps and not their absolute values usually make sense). 

                

      :rtype: `long`







      .. warning:: wxWidgets returns a non-NULL timestamp only for mouse and key events (see :ref:`wx.MouseEvent`  and :ref:`wx.KeyEvent`).   








   .. method:: IsCommandEvent(self)

      Returns ``True`` if the event is or is derived from :ref:`wx.CommandEvent`  else it returns ``False``.                  

                

      :rtype: `bool`







      .. note:: 

         exists only for optimization purposes.   








   .. method:: ResumePropagation(self, propagationLevel)

      Sets the propagation level to the given value (for example returned from an earlier call to :meth:`wx.Event.StopPropagation` ).                  


      :param `propagationLevel`: 
      :type `propagationLevel`: int







   .. method:: SetEventObject(self, object)

      Sets the originating object.                  


      :param `object`: 
      :type `object`: wx.Object







   .. method:: SetEventType(self, type)

      Sets the event type.                  


      :param `type`: 
      :type `type`: wx.EventType







   .. method:: SetId(self, id)

      Sets the identifier associated with this event, such as a button command id.                  


      :param `id`: 
      :type `id`: int







   .. method:: SetTimestamp(self, timeStamp=0)

      Sets the timestamp for the event.                  


      :param `timeStamp`: 
      :type `timeStamp`: long







   .. method:: ShouldPropagate(self)

      Test if this event should be propagated or not, i.e. if the propagation level is currently greater than 0.                  

      :rtype: `bool`








   .. method:: Skip(self, skip=True)

      This method can be used inside an event handler to control whether further event handlers bound to this event will be called after the current one returns.                  

      Without :meth:`Skip`   (or equivalently if Skip(false) is used), the event will not be processed any more. If Skip(true) is called, the event processing system continues searching for a further handler function for this event, even though it has been processed already in the current handler. 

      In general, it is recommended to skip all non-command events to allow the default handling to take place. The command events are, however, normally not skipped as usually a single command such as a button click or menu item selection must only be processed by one handler.                  


      :param `skip`: 
      :type `skip`: bool







   .. method:: StopPropagation(self)

      Stop the event from propagating to its parent window.                  

      Returns the old propagation level value which may be later passed to :meth:`ResumePropagation`   to allow propagating the event again.                  

      :rtype: `int`








   .. attribute:: EventObject

      See :meth:`~wx.Event.GetEventObject` and :meth:`~wx.Event.SetEventObject`


   .. attribute:: EventType

      See :meth:`~wx.Event.GetEventType` and :meth:`~wx.Event.SetEventType`


   .. attribute:: Id

      See :meth:`~wx.Event.GetId` and :meth:`~wx.Event.SetId`


   .. attribute:: Skipped

      See :meth:`~wx.Event.GetSkipped`


   .. attribute:: Timestamp

      See :meth:`~wx.Event.GetTimestamp` and :meth:`~wx.Event.SetTimestamp`