pythonCOM with Flash

Guyon Morée gumuz at looze.net
Thu Jun 12 08:49:26 EDT 2003


I am afraid that I can not answer this question for you, but I am very
interested in the Flash/Python combination though. I allways like to try out
new gui/code combinations.

Please let me know if you have any url's or something like that


"Bradley Schatz" <bradley at greystate.com> wrote in message
news:RvPFa.37$zx6.1430 at news.optus.net.au...
> Hi,
>
> I am attempting to use Flash as a UI for a python program. I have
> successfully prototyped this using VB/Flash, and am not trying to convert
it
> over to work with python.
>
> My problem is this, when I run the following code (attached below) nothing
> happens.
>
> I assume that the Flash activex component needs to be placed in some
> container to be seen, as I am not seeing any window come up when I run
this.
>
> Could anyone suggest how to embed this into a container?
>
> Many thanks,
>
> Bradley
>
>
>
> # Flashevents - test flash/python interop
> from win32com.client import DispatchWithEvents, Dispatch
> import msvcrt, pythoncom
> import time, sys
> import types
>
> import threading
> stopEvent = threading.Event()
>
> def TestFlash():
>     class FlashEvents:
>  def OnFSCommand(self, command, args):
>   print "FSCommend" , command
>  def OnProgress(self, percentDone):
>   print "PercentDone", percentDone
>  def OnReadyStateChange(self, newState):
>   print "State", newState
>
>     e = DispatchWithEvents("ShockwaveFlash.ShockwaveFlash", FlashEvents)
>     e.seen_events = {}
>     e.LoadMovie(0,
> "http://atomfilms.shockwave.com/afassets/flash/hump_starwars.swf")
>     e.Play()
>     if not _WaitForFinish(e, 10000):
>         e.Quit()
>
>
>
> def _WaitForFinish(ob, timeout):
>     end = time.time() + timeout
>     while 1:
>         if msvcrt.kbhit():
>             msvcrt.getch()
>             break
>         pythoncom.PumpWaitingMessages()
>         stopEvent.wait(.2)
>         if stopEvent.isSet():
>             stopEvent.clear()
>             break
>
>     return 1
>
>
> def test():
>     import sys
>     TestFlash()
>
> if __name__=='__main__':
>     test()
>
>
>






More information about the Python-list mailing list