I wrote this simple threading app using pygame. I'm looking to load a
movie via mplayer in full screen mode and have all my events be sent
to my python app and not mplayer. When my mouse is over the python app
it handles the events but when its over the mplayer window it handles
mplayer only. I'm new to threads so if anyone has a really great
tutorial let me know. My book didn't go into great detail
import pygame
from pygame.locals import *
import thread
from time import sleep, time, ctime
import os
import sys
mplayer_loc = '/usr/local/bin/mplayer'
mplayer_args = ' -vo xv -slave '
file = '/dump/mp3s/1short.mpeg'
def loop0():
print "using mplayer which is at: ", mplayer_loc
os.system(mplayer_loc + mplayer_args + file)
while 1:
for event in pygame.event.get():
if event.type == KEYDOWN:
print "KeyDown on the MOVIE!",
event.key
def main():
pygame.init()
window = pygame.display.set_mode((600,400))
pygame.display.set_caption('testing')
#pygame.display.toggle_fullscreen()
print 'starting threads'
thread.start_new_thread(loop0, ())
while 1:
for event in pygame.event.get():
if event.type == KEYDOWN:
print "KeyDown", event.key
print 'all done at: ', ctime(time())
if __name__ == '__main__':
main()