OnEventLoopEnter() seems to be incoherent

Hi,

I want to start an action as soon as the main loop starts.
To do that, I’ve overridden the method OnEventLoopEnter(), but his behaviour seems to me incoherent between different wxPython versions and OS.

On Linux, using Python 3.4.1 with wxPython 3.0.3.dev1820+49a8884 gtk2 (phoenix), the method is called with an instance of wx._core.EventLoopBase as argument.
On Linux, using Python 2.7.9 with wxPython 2.8.12.1 (gtk2-unicode), the method is never called.
On Windows 7, using Python 2.7.9 with wxpython 3.0.2.0 msw (classic), the method is called, but without argument.

It’s the expected behaviour ? How can I be sure that OnEventLoopEnter() will be called ?

Alternatively, maybe there are others ways to start a task when the main loop start ?

Here is the script I’ve tested:
import wx

class MyApp(wx.App):

def OnInit(self):
    print("OnInit()")
    frame = wx.Frame(None, wx.ID_ANY, "Hello World")
    frame.Show(True)
    self.SetTopWindow(frame)
    return True

def OnEventLoopEnter(self, loop=None):
    print('OnEventLoopEnter()')
    print('Loop is: %s' % loop)

app = MyApp()
app.MainLoop()

``

Thanks

Kévin Bernard-Allies wrote:

I want to start an action as soon as the main loop starts.

Why? What is the point? Why not just perform your action immediately
before you call app.MainLoop()? The effect is exactly the same.

Alternatively, maybe there are others ways to start a task when the
main loop start ?

You could call wx.CallAfter after you create MyApp but before you call
MainLoop. That queues up a very early message, although does arrive
after OnEventLoopEnter.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.