473,414 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

thread focus question.

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()
Jul 18 '05 #1
1 2337
In article <9d**************************@posting.google.com >,
Mike Zupan <mz****@meso.com> wrote:

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.


It appears that mplayer is a separate process. The only way what you
want will work would be if you can get mplayer to forward events over a
socket or something.
--
Aahz (aa**@pythoncraft.com) <*> http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Chris | last post by:
I'm using eight links listed horizontally as a menu on my site. I'm using font-variant:small-caps and they are padded so that they mimic buttons. My gripe is with the way IE handles the focus...
4
by: Dean Bortell | last post by:
I am writing a multi-threaded program with a worker thread. I want the rich text box to auto scroll down as the text is added. Here is what I want to happen: From the worker thread: 1. Add the...
5
by: Dante | last post by:
Hello all, I have an application that is used for porting data from one system to another. There is a scan button that starts a new thread that does the processing. Everything seems to work...
3
by: Frederik Vanderhaegen | last post by:
Hi, I've written a sort of wizard in which the user has to answer some questions. This wizard contains a radiobuttonlist en two buttons (back and next). With the first question there's no...
51
by: Hans | last post by:
Hi all, Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() ...
0
by: agasca | last post by:
Hi. i'm using c# in net 2.0. winxp-sp2 machine. I have a form, say FormGrid in that i have to do some work... there is a problem, related to datagridview and the datatable in the DataSource, and...
2
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. ...
3
by: Simon | last post by:
Dear reader, On the event "Lost focus" I make the ComboBox invisible but the massage pops up "You can't hide a control that has the focus." But this code is written in the "Lost focus"...
2
by: obtrs | last post by:
im using java script for form validation.. here is the code <script type="text/JavaScript"> function validate_required(field,alerttxt) { with (field)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.