473,785 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(mplay er_loc + mplayer_args + file)
while 1:
for event in pygame.event.ge t():
if event.type == KEYDOWN:
print "KeyDown on the MOVIE!",
event.key

def main():
pygame.init()
window = pygame.display. set_mode((600,4 00))
pygame.display. set_caption('te sting')
#pygame.display .toggle_fullscr een()
print 'starting threads'
thread.start_ne w_thread(loop0, ())
while 1:
for event in pygame.event.ge t():
if event.type == KEYDOWN:
print "KeyDown", event.key
print 'all done at: ', ctime(time())
if __name__ == '__main__':
main()
Jul 18 '05 #1
1 2348
In article <9d************ **************@ posting.google. com>,
Mike Zupan <mz****@meso.co m> 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**@pythoncra ft.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
10559
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 rectangle on these links. It insists on drawing this crazy shape that traces the text, which with small caps looks rather assinine. Firefox handles the same task very gracefully (yeah Gecko!) and I would like to force IE to do the same. The site...
4
2359
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 text to a richtextbox named txtMessageBody. 2. Make sure that the scroll is to the bottom of the box. 3. Put the focus back on the box where the user enters text This is from a basic messenger I am writing. The problem only occurs when trying...
5
1625
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 fine unless the application loses focus. If the app loses focus the form will no longer refresh and it just sits there. If I click where one of the buttons used to be the app just says not responding in the title bar.
3
2390
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 problem because I only show one button but with the second question the problems start. In the beginning no control has the focus but when the user select an option from the list, the focus is automaticly set on the back button. So when the user...
51
54877
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() # This thread is expected to finish within a second
0
1783
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 this problem require to work with the datatable in the same thread the dataridview is. So, i make another thread with another form, say FormWatch to see the progress in formGrid. something like this: In FormGrid i have something like: void...
2
2478
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. http://www.littleworksstudio.com/temp/usenet/focus.html To simulate the problem, just enter or change the "first" textbox and either click or tab to another control., it is tied to the onchange event. An alert box that simulates the "warning". When you close it the focus will not move...
3
7045
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" event so the combobox has not longer the focus regarding this event.
2
1895
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
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.