Python help: Sending a "play" command to quicktime, or playing a movie in python
clp2 at rebertia.com
Sat Oct 24 01:10:20 CEST 2009
> On Fri, Oct 23, 2009 at 5:17 PM, Chris Rebert <clp2 at rebertia.com> wrote:
>> On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <varnonzero at gmail.com> wrote:
>>> I'm sure this is a simple problem, or at least I hope it is, but I'm
>>> not an experience programer and the solution eludes me.
>>> My realm of study is the behavioral sciences. I want to write a
>>> program to help me record data from movie files.
>>> Currently I have a program that can record the time of a keystroke so
>>> that I can use that to obtain frequency, duration and other temporal
>>> characteristics of the behaviors in my movies.
>>> What I really want, is a way to start playing the movie. Right now I
>>> have to play the movie, then switch to my program. I would love it if
>>> it were possible for me to have my program send a message to quicktime
>>> that says "play." Or any other work around really. If python could
>>> play the movie, that would work just as well.
>>> I'm using a mac btw.
>>> Any suggestions?
>> import subprocess
>> subprocess.Popen(["open", "path/to/the/movie.file"])
>> Docs for the subprocess module: http://docs.python.org/library/subprocess.html
>> For information on the Mac OS X "open" command, `man open` from Terminal.
On Fri, Oct 23, 2009 at 4:05 PM, Chris Varnon <varnonzero at gmail.com> wrote:
> Thanks, That works wonderfuly. Once I set quicktimes preferences to
> "play on open" it opens and plays the movie exactly like I want.
> But now I need a line of code to bring python to the front again so it
> can read my input. Any more suggestions?
Add the -g option so focus isn't given to Quicktime (this is covered
in the manpage I pointed you to):
subprocess.Popen(["open", "-g", "path/to/the/movie.file"])
Also, in the future, try to avoid top-posting (see
More information about the Python-list