proDiva
Что значит “под оффтопиком”? Я проверила, есть либы wx для открытия pdf, html, flash-файлов. и есть просто ActiveXWindow, т.е. возможно использовать файлы других приложений, только как это сделать? может кому-то встречались примеры?
Вот пример из закромов родины
“”“
<html><body>
This demo shows how to embed an ActiveX control in a wxPython application, (Win32 only.)
<p>
The MakeActiveXClass function dynamically builds a new Class on the fly, that has the
same signature and semantics as wxWindow. This means that when you call the function
you get back a new class that you can use just like wxWindow, (set the size and position,
use in a sizer, etc.) except its contents will be the COM control.
</body></html>
”“”
import wx
from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache
excelModule = win32com.client.gencache.EnsureModule(“{00020813-0000-0000-C000-000000000046}”, 0, 1, 2)
#———————————————————————-
class TestPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
sizer = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
# this function creates a new class that can be used as a
# wxWindow, but contains the given ActiveX control.
ActiveXWrapper = MakeActiveXClass(excelModule.Application)
# create an instance of the new class
self.excel = ActiveXWrapper( self, -1, style=wx.SUNKEN_BORDER)
sizer.Add(self.excel, 1, wx.EXPAND)
btnSizer.Add(50, -1, 2, wx.EXPAND)
sizer.Add(btnSizer, 0, wx.EXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(true)
#———————————————————————-
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#———————————————————————-
if __name__ == ‘__main__’:
import sys
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, “ActiveX test – Excel”, size=(640, 480),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
self.tp = TestPanel(self, sys.stdout)
def OnCloseWindow(self, event):
self.tp.excel.Cleanup()
self.Destroy()
app = wx.PySimpleApp()
frame = TestFrame()
frame.Show(True)
app.MainLoop()