Thanks Kartic,
Don't know if i have understand everything, but i 'll try using your lights,
To integrate a flash movie using wx, here is a piece of code (the Flash.py
is auto-generated by makepy.py)
### testFlash.py
from wxPython.wx import *
import os
if wxPlatform == '__WXMSW__':
from wxPython.lib.activexwrapper import MakeActiveXClass
#import win32com.client.gencache
#import win32com.client
import flash
flashControl = flash
class FlashPanel(wxPanel):
def __init__(self, parent, flashFile):
wxPanel.__init__(self, parent, -1)
sizer = wxBoxSizer(wxVERTICAL)
ActiveXWrapper = MakeActiveXClass(flashControl.ShockwaveFlash)
self.Flash = ActiveXWrapper( self, -1)
self.Flash.Movie = os.path.join(os.getcwd(), flashFile)
self.Flash.Menu=False
self.Flash.OnFSCommand = self.OnFSCommand
sizer.Add(self.Flash, 1, wxEXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(True)
EVT_WINDOW_DESTROY(self, self.OnDestroy)
def OnDestroy(self, evt):
if self.Flash:
self.Flash.Cleanup()
self.Flash = None
def OnFSCommand(self, command, *args):
if command=="openFile":
self.openFile()
if command=="saveFile":
self.saveFile(*args)
def openFile(self):
dlg = wxFileDialog(self, "Choose", "", "", "*.*", wxOPEN)
if dlg.ShowModal()==wxID_OK:
filename = dlg.GetFilename()
dirname = dlg.GetDirectory()
f = open(os.path.join(dirname, filename), "r")
self.Flash.SetVariable("PyReply", f.read())
f.close()
dlg.Destroy()
def saveFile(self, text):
dlg = wxFileDialog(self, "Save As", "", "", "*.*",
wxSAVE|wxOVERWRITE_PROMPT)
if dlg.ShowModal()==wxID_OK:
filename = dlg.GetFilename()
dirname = dlg.GetDirectory()
f = open(os.path.join(dirname, filename), "w")
f.write(text)
f.close()
dlg.Destroy()
if __name__ == '__main__':
class FlashFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, None, -1, "PyFlash -- Simple
File Viewer",
size=(550, 400))
self.flashPanel = FlashPanel(self, "testFlash.swf")
app = wxPySimpleApp()
frame = FlashFrame()
frame.Show(True)
app.MainLoop()
### Flash.py
# -*- coding: mbcs -*-
# Created by makepy.py version 0.4.8
# By python version 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit
(Intel)]
# From type library '{D27CDB6B-AE6D-11CF-96B8-44455354}'
# On Tue Mar 16 01:58:37 2004
"""Shockwave Flash"""
makepy_version = '0.4.8'
python_version = 0x20303f0
import win32com.client.CLSIDToClass, pythoncom
import win32com.client.util
from pywintypes import IID
from win32com.client import Dispatch
# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing and pythoncom.Empty
defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty
CLSID = IID('{D27CDB6B-AE6D-11CF-96B8-44455354}')
MajorVersion = 1
MinorVersion = 0
LibraryFlags = 8
LCID = 0x0
from win32com.client import DispatchBaseClass
class IShockwaveFlash(DispatchBaseClass):
"""Shockwave Flash"""
CLSID = IID('{D27CDB6C-AE6D-11CF-96B8-44455354}')
coclass_clsid = IID('{D27CDB6E-AE6D-11CF-96B8-44455354}')
#default_interface = IShockwaveFlash
#default_source = _IShockwaveFlashEvents
def Back(self):
"""method Back"""
return self._oleobj_.InvokeTypes(114, LCID, 1, (24, 0), (),)
def CurrentFrame(self):
"""method CurrentFrame"""
return self._oleobj_.InvokeTypes(128, LCID, 1, (3, 0), (),)
def FlashVersion(self):
"""method FlashVersion"""
return self._oleobj_.InvokeTypes(132, LCID, 1, (3, 0), (),)
def Forward(self):
"""method Forward"""
return self._oleobj_.InvokeTypes(115, LCID, 1, (24, 0), (),)
def FrameLoaded(self, FrameNum=defaultNamedNotOptArg):
"""method FrameLoaded"""
return self._oleobj_.InvokeTypes(131, LCID, 1, (11, 0), ((3,
1),),FrameNum)
def GetVariable(self, name=defaultNamedNotOptArg):
"""method GetVariable"""
# Result is a Unicode object - return as-is for this version of
Python
return self._oleobj_.InvokeTypes(152, LCID, 1,