Why wx.AboutBox close button does not close the program

Hi,

I have a test program testwx.py to run wx.AboutBox running on CentOS 6.2, it is running fine, but click the close button, it closed the message box, but program testwx.py hang up until I manually kill it., what could be missing here?

import wx

class InfoBox(wx.Frame):

def __init__(self, *args, **kwargs):
    super(InfoBox, self).__init__(*args, **kwargs)

def MessageBox(self, message):
    info = wx.AboutDialogInfo()
    info.SetName("Test")
    wx.AboutBox(info)

def Test():
ex = wx.App()
info = InfoBox(None)
info.MessageBox(“hello test”)
ex.MainLoop()

Test()

Thank you.

Hi,

I think you need to explicitly destroy them when you are done.

If you add “info.MessageBox.destroy” above your line “ex.MainLoop()”, then I think it will behave the way you expect.

More info on this topic can be found at the excellent Zetcode site - http://zetcode.com/wxpython/dialogs/

HTH.

Cheers,

Scott.

···

On Thu, Nov 7, 2013 at 8:32 PM, nobody h jupiter.hce@gmail.com wrote:

Hi,

I have a test program testwx.py to run wx.AboutBox running on CentOS 6.2, it is running fine, but click the close button, it closed the message box, but program testwx.py hang up until I manually kill it., what could be missing here?

import wx

class InfoBox(wx.Frame):

def __init__(self, *args, **kwargs):
    super(InfoBox, self).__init__(*args, **kwargs)

def MessageBox(self, message):
    info = wx.AboutDialogInfo()

    info.SetName("Test")
    wx.AboutBox(info)

def Test():
ex = wx.App()
info = InfoBox(None)
info.MessageBox(“hello test”)
ex.MainLoop()

Test()

Thank you.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Hi,

I think you need to explicitly destroy them when you are done.

If you add “info.MessageBox.destroy” above your line “ex.MainLoop()”, then I think it will behave the way you expect.

Hmm, that does not work, it exited immediately. It seems close the window does not close the wx.AboutBox, the class was not destroyed, even I put a destruct which was not called.

More info on this topic can be found at the excellent Zetcode site - http://zetcode.com/wxpython/dialogs/

They put an panel on top of the wx.AboutBox, that works, but with wxAboutBox alone and wx.App, events seem lost.

Thanks.

···

On Friday, November 8, 2013 1:21:31 PM UTC+11, grun...@gmail.com wrote:

On Thu, Nov 7, 2013 at 8:32 PM, nobody h jupit...@gmail.com wrote:

Hi,

I have a test program testwx.py to run wx.AboutBox running on CentOS 6.2, it is running fine, but click the close button, it closed the message box, but program testwx.py hang up until I manually kill it., what could be missing here?

import wx

class InfoBox(wx.Frame):

def __init__(self, *args, **kwargs):
    super(InfoBox, self).__init__(*args, **kwargs)

def MessageBox(self, message):
    info = wx.AboutDialogInfo()

    info.SetName("Test")
    wx.AboutBox(info)

def Test():
ex = wx.App()
info = InfoBox(None)
info.MessageBox(“hello test”)
ex.MainLoop()

Test()

Thank you.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Basically you haven’t told the AboutBox to close the program.
You need to have an event, e.g. closing the message box, which
triggers a exit on the App.MainLoop and after that has finished,
i.e. at the end of Test you need to destroy the App. Gadget/Steve

···

On 08/11/13 05:36, nobody h wrote:

    On Friday, November 8, 2013 1:21:31 PM UTC+11, wrote:

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to .
For more options, visit .

grun...@gmail.com

Hi,

          I think you need to explicitly destroy them when you

are done.

          If you add "info.MessageBox.destroy" above your line

“ex.MainLoop()”, then I think it will behave the way you
expect.

      Hmm, that does not work, it exited immediately. It seems close

the window does not close the wx.AboutBox, the class was not
destroyed, even I put a destruct which was not called.

          More info on this topic can be found at the excellent

Zetcode site - http://zetcode.com/wxpython/dialogs/

      They put an panel on top of the wx.AboutBox, that works, but

with wxAboutBox alone and wx.App, events seem lost.

      Thanks.

        On Thu, Nov 7, 2013 at 8:32 PM,

nobody h jupit...@gmail.com
wrote:

Hi,

            I have a test program testwx.py to run wx.AboutBox

running on CentOS 6.2, it is running fine, but click the
close button, it closed the message box, but program
testwx.py hang up until I manually kill it., what could
be missing here?

            import wx





            class InfoBox(wx.Frame):



                def __init__(self, *args, **kwargs):

                    super(InfoBox, self).__init__(*args, **kwargs)



                def MessageBox(self, message):

                    info = wx.AboutDialogInfo()

                    info.SetName("Test")

                    wx.AboutBox(info)



            def Test():

                ex = wx.App()

                info = InfoBox(None)

                info.MessageBox("hello test")

                ex.MainLoop()



            Test()



            Thank you.
              --

              You received this message because you are subscribed

to the Google Groups “wxPython-users” group.

              To unsubscribe from this group and stop receiving

emails from it, send an email to wxpython-user...@googlegroups.com.

              For more options, visit [https://groups.google.com/groups/opt_out](https://groups.google.com/groups/opt_out).

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out

You normally would call the AboutBox from a menu and in there its
handler you should ensure that the dialog gets distroyed
(dialog.Destroy or using ‘with’).
In your sample you could just do this:
info.MessageBox(“hello test”)
info.Close()
Werner

···

Hi,

  On 08/11/2013 06:36, nobody h wrote:
    On Friday, November 8, 2013 1:21:31 PM UTC+11, wrote:

grun...@gmail.com

Hi,

          I think you need to explicitly destroy them when you

are done.

          If you add "info.MessageBox.destroy" above your line

“ex.MainLoop()”, then I think it will behave the way you
expect.

      Hmm, that does not work, it exited immediately. It seems close

the window does not close the wx.AboutBox, the class was not
destroyed, even I put a destruct which was not called.

          More info on this topic can be found at the excellent

Zetcode site - http://zetcode.com/wxpython/dialogs/

      They put an panel on top of the wx.AboutBox, that works, but

with wxAboutBox alone and wx.App, events seem lost.

You created an ‘InfoBox’ frame and forgot to show/close it. The program will keep on running if there is a top-level window alive.

Mark

···

At 2013-11-08 09:32:31,“nobody h” jupiter.hce@gmail.com wrote:

Hi,

I have a test program testwx.py to run wx.AboutBox running on CentOS 6.2, it is running fine, but click the close button, it closed the message box, but program testwx.py hang up until I manually kill it., what could be missing here?

import wx

class InfoBox(wx.Frame):

def __init__(self, *args, **kwargs):
    super(InfoBox, self).__init__(*args, **kwargs)

def MessageBox(self, message):
    info = wx.AboutDialogInfo()
    info.SetName("Test")
    wx.AboutBox(info)

def Test():
ex = wx.App()
info = InfoBox(None)
info.MessageBox(“hello test”)
ex.MainLoop()

Test()

Thank you.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.