Using wxPython in COM server

Nikolai Kirsebom nikolai.kirsebom at siemens.no
Wed Dec 1 03:40:23 EST 1999


I have one question related to my usage of wxPython in a COM servers.

I would like to have a method in my com-server which presents a dialog
requesting Yes/No from the user, in principle as shown below.  The
method (com-server) is being used from Word97.

----------------------------

   def RequestYesNo(self):
      from wxPython.wx import *
      win = wxDialog(NULL, -1, "HELLO", wxDefaultPosition, wxSize(350,
200))
      wxStaticText(win, -1, "This is a wxDialog", wxPoint(20, 20))
      wxButton(win, wxID_OK,     " OK ", wxPoint(75, 120),
wxDefaultSize).SetDefault()
      wxButton(win, wxID_CANCEL, " Cancel ", wxPoint(200, 120),
wxDefaultSize)
      val = win.ShowModal()
      return val
----------------------------

I manage to get the dialog presented, but at the same time I get an
application error in winword.exe (The instruction at "0x...."
referenced memory at "0x0000000".  The memory could not be "read".)

When I select OK in the application error message box, my dialog is
completely painted (static text and buttons), and I get e new message
box from the runtime library of Microsoft Visual C++ (Runtime error!
Program: C:\Program.....\Winword.exe abnormal program termination).
  
Does anyone have any idea what the problem is.  A friend of mine
(who's not familiar with the Python environment) though it could have
something to do with the message loop being executed when my dialog is
presented dispatches some events that Word does not 'like'.

Thanks
Nikolai Kirsebom


Environment: NT4 SP 5, Python 1.5.2b, PythonWin 127, wxPython 2.1.11





More information about the Python-list mailing list