Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Zoool
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,

Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Kartic
The Great 'Exeem' uttered these words on 4/30/2005 11:37 AM:
Kartic,
Thanks for your reply,
I already use the wxPython to embbed my flash animation
###
from wxPython.lib.activexwrapper import MakeActiveXClass
ActiveXWrapper = MakeActiveXClass(flashActiveXLib.ShockwaveFlash, 
eventClass=None, eventObj=self)

Flash = ActiveXWrapper( self, -1, style=wxSUNKEN_BORDER)

It work fine and i can control my flash animation from Python without 
problem..

But the Wrapper need the flash.ock to be installed on the user system in 
order to work,
and i would like to make an executable application that include the 
flash.ocx or load it on startup for
users who doesn't have the flash player installed.
I would like also to be able to load a flash animation from memory and not 
to load it from external file.

Don't know if you understand me.. Take a look at 
http://www.flashplayercontrol.com/ .. I'd like such a solution for Python,
don't know if i can use that dll from Python or make a module myself..

Anyway, thank a lot for your interest
Dan

Dan,
Ah! I see what you are trying to do. While I don't have a working piece 
of code to share with you, I can give you a few ideas that you could 
consider:

1. Supply the Macromedia OCX with your app. Try to use the wxActivex 
class and if that fails, register your copy of the OCX. You can do this 
either using a batch file invoking regsvr32 or use Win32 to register. 
The flip side: The flash will be loaded from a file rather than memory.

2. Wrap the flashplayercontrol.com's DLL in an Activex control using VB 
and distribute your OCX. And then use wxActivex to access your OCX.

3. Use SWIG to generate Python bindings for the DLL. I have never done 
this and I am sure some of the more erudite members of the newsgroup can 
shed some light.

4. Call the supplied DLL using Ctypes. In this case, you can convert the 
example under the "Features" link of that site in DLL calls using 
Ctypes. Question: How will that integrate with wx?

Hope that helped a bit.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Exeem

Kartic,

Thanks for your reply,

I already use the wxPython to embbed my flash animation

###
from wxPython.lib.activexwrapper import MakeActiveXClass

ActiveXWrapper = MakeActiveXClass(flashActiveXLib.ShockwaveFlash, 
eventClass=None, eventObj=self)

Flash = ActiveXWrapper( self, -1, style=wxSUNKEN_BORDER)


It work fine and i can control my flash animation from Python without 
problem..

But the Wrapper need the flash.ock to be installed on the user system in 
order to work,
and i would like to make an executable application that include the 
flash.ocx or load it on startup for
users who doesn't have the flash player installed.
I would like also to be able to load a flash animation from memory and not 
to load it from external file.

Don't know if you understand me.. Take a look at 
http://www.flashplayercontrol.com/ .. I'd like such a solution for Python,
don't know if i can use that dll from Python or make a module myself..

Anyway, thank a lot for your interest

Dan


"Kartic" <[EMAIL PROTECTED]> a écrit dans le message 
de news: [EMAIL PROTECTED]
> The Great 'Exeem' uttered these words on 4/29/2005 2:11 PM:
>> Hi All,
>>
>> I'm trying to find a way to embbed the flash.ocx object in a Windows 
>> Python application,
>> I've successfully integrated a flash object with the ocx already 
>> installed on the system using the Activex Wrapper,
>> but i would like to embbed it inside my application in order to 
>> distribute my application without the need for the user to install the 
>> flash player.
>> It would like also to embbed the flash animation inside my application 
>> without loading it .. i mean directly from the memory.
>>
>> I've seen that it was possible in C++ or in Delphi, using the 
>> http://www.flashplayercontrol.com/ .. but don't know how to make it in 
>> Python.
>>
>> Any ideas are welcome
>>
>> Dan.
>
>
> Dan,
>
> wxPython has the capability to embed Flash inside a wxPython panel. It 
> uses Macromedia's Flash ocx that is installed when installing flash player 
> on Windows. And it is pretty nifty; take a look at the demo.
>
> From your message, it is appears you are using win32gui functions but I am 
> unable to tell. So using Win32, I do not know how you can do what you are 
> trying. But yeah, look into wxPython!
>
> Please let me know if you need more assistance.
>
> Thanks,
> -Kartic 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Kartic
The Great 'Exeem' uttered these words on 4/29/2005 2:11 PM:
Hi All,
I'm trying to find a way to embbed the flash.ocx object in a Windows Python 
application,
I've successfully integrated a flash object with the ocx already installed 
on the system using the Activex Wrapper,
but i would like to embbed it inside my application in order to distribute 
my application without the need for the user to install the flash player.
It would like also to embbed the flash animation inside my application 
without loading it .. i mean directly from the memory.

I've seen that it was possible in C++ or in Delphi, using the 
http://www.flashplayercontrol.com/ .. but don't know how to make it in 
Python.

Any ideas are welcome
Dan. 

Dan,
wxPython has the capability to embed Flash inside a wxPython panel. It 
uses Macromedia's Flash ocx that is installed when installing flash 
player on Windows. And it is pretty nifty; take a look at the demo.

From your message, it is appears you are using win32gui functions but I 
am unable to tell. So using Win32, I do not know how you can do what you 
are trying. But yeah, look into wxPython!

Please let me know if you need more assistance.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


[newbie] Embedding Flash OCX object

2005-04-29 Thread Exeem

Hi All,

I'm trying to find a way to embbed the flash.ocx object in a Windows Python 
application,
I've successfully integrated a flash object with the ocx already installed 
on the system using the Activex Wrapper,
but i would like to embbed it inside my application in order to distribute 
my application without the need for the user to install the flash player.
It would like also to embbed the flash animation inside my application 
without loading it .. i mean directly from the memory.

I've seen that it was possible in C++ or in Delphi, using the 
http://www.flashplayercontrol.com/ .. but don't know how to make it in 
Python.

Any ideas are welcome

Dan. 


-- 
http://mail.python.org/mailman/listinfo/python-list