Simple message box application

I have a simple message box application called test.py:

from wxPython.wx import *

class test(wxApp):

    def OnInit(self):

         myResult = 0
         myMessageBox = ""

         myMessageBox = wxMessageDialog(NULL,
                                        "Yes or No.",
                                        "test",
                                        wxYES_NO | wxICON_QUESTION)

         myResult = myMessageBox.ShowModal()

         return true

mytest = test()
mytest.MainLoop()

When I run this, I get the following error:

test.py:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible.
    from wxPython.wx import *

I have rewritten the test program as follows:

import wx

class test(wx.App):

    def OnInit(self):

         myResult = 0
         myMessageBox = ""

         myMessageBox = wx.MessageDialog(self,
                                         "Yes or No.",
                                         "test",
                                         wx.YES_NO | wx.ICON_QUESTION)

         myResult = myMessageBox.ShowModal()

         return True

mytest = test(redirect=False)
mytest.MainLoop()

When I run this, I get the following error:

TypeError: in method 'new_MessageDialog', expected argument 1 of type 'wxWindow *'

Is there a way to display a message box without creating and displaying a window that contains it? The examples that I have found googling all create a window that contains the message box. Any help is appreciated.

Oooop! Just gotta change the first parameter to wx.MessageDialog in the second example from self to None and then it works.

···

On Oct 20, 2007, at 5:12 AM, Dave Mihalik wrote:

I have a simple message box application called test.py:

from wxPython.wx import *

class test(wxApp):

   def OnInit(self):

        myResult = 0
        myMessageBox = ""

        myMessageBox = wxMessageDialog(NULL,
                                       "Yes or No.",
                                       "test",
                                       wxYES_NO | wxICON_QUESTION)

        myResult = myMessageBox.ShowModal()

        return true

mytest = test()
mytest.MainLoop()

When I run this, I get the following error:

test.py:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained. Please switch to the wx package as soon as possible.
   from wxPython.wx import *

I have rewritten the test program as follows:

import wx

class test(wx.App):

   def OnInit(self):

        myResult = 0
        myMessageBox = ""

        myMessageBox = wx.MessageDialog(self,
                                        "Yes or No.",
                                        "test",
                                        wx.YES_NO | wx.ICON_QUESTION)

        myResult = myMessageBox.ShowModal()

        return True

mytest = test(redirect=False)
mytest.MainLoop()

When I run this, I get the following error:

TypeError: in method 'new_MessageDialog', expected argument 1 of type 'wxWindow *'

Is there a way to display a message box without creating and displaying a window that contains it? The examples that I have found googling all create a window that contains the message box. Any help is appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org