wx.MessaegBox closes immediately with wxPy 2.9+

I have an app which uses lots of wx.MessaegBox() calls.
On wxPy 2.8 the message box appears and stays there until OK or Cancel
is pressed.
On wxPy 2.9 & 3.0 the message box appears briefly then immediately closes.
Why does this happen and is it expected ?

Should I be using wx.MessageDialog or another wx function/class ?

test code:
    app = wx.App()
    ans = wx.MessageBox(caption="Test Caption", message="Test Message 1
2 3 ...")
    app.MainLoop()

Thanks, Brendan.

Hi,

···

On 6/25/2014 12:51, Brendan Simon (eTRIX) wrote:

app = wx.App()
     ans = wx.MessageBox(caption="Test Caption", message="Test Message 1
2 3 ...")
     app.MainLoop()

What Python version and Platform?

For me it works on Win8 with Python 2.7 and wxPython 2.9.5 and wxPython 3.0.1.dev76109 (Phoenix), in other words I see the box and have to press the "OK" button to close it.

Werner

The code appears to work on Win7 32bit with Python 2.7.5 and wxPython 2.9.5.0, I can test it against the versions on my laptop during my lunch break.

···

On Wednesday, June 25, 2014 6:51:18 AM UTC-4, Brendan wrote:

I have an app which uses lots of wx.MessaegBox() calls.

On wxPy 2.8 the message box appears and stays there until OK or Cancel

is pressed.

On wxPy 2.9 & 3.0 the message box appears briefly then immediately closes.

Why does this happen and is it expected ?

Should I be using wx.MessageDialog or another wx function/class ?

test code:

app = wx.App()

ans = wx.MessageBox(caption="Test Caption", message="Test Message 1

2 3 …")

app.MainLoop()

Thanks, Brendan.

Forgot to mention that I am running on OS X
(10.8) with Python.org 2.7.7 installed.

···

On 25/06/14 10:31 PM, Mike Stover
wrote:

    The code appears to work on Win7 32bit with Python

2.7.5 and wxPython 2.9.5.0, I can test it against the versions
on my laptop during my lunch break.

    On Wednesday, June 25, 2014 6:51:18 AM UTC-4, Brendan wrote:
        I have an app which uses lots of

wx.MessaegBox() calls.

        On wxPy 2.8 the message box appears and stays there until OK

or Cancel

        is pressed.


        On wxPy 2.9 & 3.0 the message box appears briefly then

immediately closes.

        Why does this happen and is it expected ?




        Should I be using wx.MessageDialog or another wx

function/class ?

        test code:


            app = wx.App()


            ans = wx.MessageBox(caption="Test Caption",

message="Test Message 1

        2 3 ...")


            app.MainLoop()






        Thanks, Brendan.

see this similar issue posted a few days ago on this list:
https://groups.google.com/forum/#!topic/wxpython-users/ZE_xSGwx-QM

Call the dialog after you call mainloop.

···

On Wednesday, June 25, 2014 7:00:37 AM UTC-7, Brendan wrote:

  Forgot to mention that I am running on OS X

(10.8) with Python.org 2.7.7 installed.

  On 25/06/14 10:31 PM, Mike Stover > wrote:
    The code appears to work on Win7 32bit with Python

2.7.5 and wxPython 2.9.5.0, I can test it against the versions
on my laptop during my lunch break.

    On Wednesday, June 25, 2014 6:51:18 AM UTC-4, Brendan wrote:
        I have an app which uses lots of

wx.MessaegBox() calls.

        On wxPy 2.8 the message box appears and stays there until OK

or Cancel

        is pressed.


        On wxPy 2.9 & 3.0 the message box appears briefly then

immediately closes.

        Why does this happen and is it expected ?




        Should I be using wx.MessageDialog or another wx

function/class ?

        test code:


            app = wx.App()


            ans = wx.MessageBox(caption="Test Caption",

message="Test Message 1

        2 3 ...")


            app.MainLoop()






        Thanks, Brendan.