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