Python help: Sending a "play" command to quicktime, or playing a movie in python

Chris Varnon varnonzero at
Sat Oct 24 01:22:30 CEST 2009

>> On Fri, Oct 23, 2009 at 5:17 PM, Chris Rebert <clp2 at> wrote:
>>> On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <varnonzero at> 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:
>>> 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> 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
> Cheers,
> Chris
> --

Wonderful. I totally missed the -g option.
I use pygame for the input handling currently. Maybe its not the most
elegant solution, but it's what I knew how to do. I just wasn't sure
how to do that one last bit.
Thanks a bunch!

Also, I typicaly don't post over email lists, so I didn't think about
the top-posting. This is the prefered method right?
Thanks again.

More information about the Python-list mailing list