请问一个wxpython内嵌入wps
代码如下:
#!/usr/bin/env python
#-*-coding:utf-8-*-
import wx
from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache
wpsModule = win32com.client.gencache.EnsureModule("{00020905-0000-4B30-A977-D214852036FE}",0,2,0)
class TestPanel(wx.Window):
def __init__(self, parent, frame=None):
wx.Window.__init__(self, parent)
sizer = wx.BoxSizer(wx.VERTICAL)
self.frame = frame
self.wps = None
theClass = MakeActiveXClass(wpsModule.Application)
self.wps = theClass(self,-1)
sizer.Add(self.wps , 0, wx.EXPAND)
if __name__ == '__main__':
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "ActiveX test -- WPS",
size=(640, 480))
self.tp = TestPanel(self, frame=self)
app = wx.PySimpleApp()
frame = TestFrame()
frame.Show()
app.MainLoop()
运行错误
Traceback (most recent call last):
File "D:\wxpython_new.py", line 27, in -toplevel-
frame = TestFrame()
File "D:\wxpython_new.py", line 24, in __init__
self.tp = TestPanel(self, frame=self)
File "D:\wxpython_new.py", line 15, in __init__
self.wps = theClass(self,-1)
File "C:\Python24\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\activexwrapper.py", line 119, in axw__init__
(0, 0, sz.width, sz.height), self._wnd, ID)
File "C:\Python24\Lib\site-packages\pythonwin\pywin\mfc\activex.py", line 23, in CreateControl
self.__dict__["_obj_"] = win32ui.CreateControl(clsid, windowTitle, style, rect, parent, id, None, False, lic_string)
error: CreateControl failed
请问高手..............