Run the wx event loop by processing pending events only. This approach seems to work, but its performance is not great as it relies on having PyOS_InputHook called regularly.
(context)
| 26 | |
| 27 | @ignore_keyboardinterrupts |
| 28 | def inputhook_wx1(context): |
| 29 | """Run the wx event loop by processing pending events only. |
| 30 | |
| 31 | This approach seems to work, but its performance is not great as it |
| 32 | relies on having PyOS_InputHook called regularly. |
| 33 | """ |
| 34 | app = wx.GetApp() |
| 35 | if app is not None: |
| 36 | assert wx.Thread_IsMain() |
| 37 | |
| 38 | # Make a temporary event loop and process system events until |
| 39 | # there are no more waiting, then allow idle events (which |
| 40 | # will also deal with pending or posted wx events.) |
| 41 | evtloop = wx.EventLoop() |
| 42 | ea = wx.EventLoopActivator(evtloop) |
| 43 | while evtloop.Pending(): |
| 44 | evtloop.Dispatch() |
| 45 | app.ProcessIdle() |
| 46 | del ea |
| 47 | return 0 |
| 48 | |
| 49 | |
| 50 | class EventLoopTimer(wx.Timer): |
nothing calls this directly
no outgoing calls
no test coverage detected