[Tutor] Calling Dialog Box from a Class - Still Problems

richard python at keep-trying.com
Thu Jan 29 09:46:52 EST 2004


Following my earlier email I found that I was not on quite right.
By amending the code as follows:

def OnButton1Button(self, event):
         test = tester()

class tester:
      def Info(self,message,caption):
          dlg = wxMessageDialog(self,message, caption, wxOK | 

I now expected to finally get my dialog box, however instead it gives the
following error:

Traceback (most recent call last):
   File "D:\pythonwork\tesguis\mainmenu.py", line 66, in OnButton1Button
   File "D:\pythonwork\tesguis\mainmenu.py", line 70, in Info
     dlg = wxMessageDialog(self,message, caption, wxOK | wxICON_INFORMATION)
   File "C:\Python23\Lib\site-packages\wxPython\cmndlgs.py", line 368, in 
     self.this = cmndlgsc.new_wxMessageDialog(*_args,**_kwargs)
TypeError: Type error in argument 1 of new_wxMessageDialog. Expected 

Searching previous posts appears to be a result of me calling a
method rather than an instance.But I am calling the instance
'Info' so why is it not working?


More information about the Tutor mailing list