[Tutor] Calling Dialog Box from a Class - Still Problems
richard
python at keep-trying.com
Thu Jan 29 09:46:52 EST 2004
Greetings,
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()
test.Info('message','caption')
class tester:
def Info(self,message,caption):
dlg = wxMessageDialog(self,message, caption, wxOK |
wxICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
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
test.Info('message','caption')
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
__init__
self.this = cmndlgsc.new_wxMessageDialog(*_args,**_kwargs)
TypeError: Type error in argument 1 of new_wxMessageDialog. Expected
_wxWindow_p.
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?
Richard
More information about the Tutor
mailing list