MCPcopy Create free account
hub / github.com/ipython/ipython / inputhook_wx1

Function inputhook_wx1

IPython/lib/inputhookwx.py:33–55  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

31#-----------------------------------------------------------------------------
32
33def 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
57class EventLoopTimer(wx.Timer):
58

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected