full screen graphics

M

myheartinamerica

Hello,

I need to run a particular graphics application over and over again
with a different command line to get benchmarks on the applications
performance (frame rates and similar data). I am running the following
within a while loop that parses out a different command line from a
configuration file.

############
def runCommand(command):
"""runCommand(command)

Parameters:
command -- the full string of the command to execute

"""
print command
try:
childProcess = subprocess.Popen(command)

done = False
while not done:
returnCode = childProcess.poll()
if (returnCode != None):
done = True
else:
# sleep for 10 seconds before checking again
time.sleep(10)
except KeyboardInterrupt:
print 'KeyboardInterrupt received. Trying to kill Wolf2.exe'
print '>TASKKILL /F /T /PID ', childProcess.pid
killCommand = ''.join(('TASKKILL /F /T /PID ',
str(childProcess.pid)))
killSubProcess = subprocess.Popen(killCommand)
killSubProcess.wait()
sys.exit(0)
except OSError, (errno, strerror):
print 'OS Error (%s): %s' % (errno, strerror)
print 'Above error occurred while executing the following:'
print command
except WindowsError, (errno, strerror):
print 'MS Windows Error (%s): %s' % (errno, strerror)
print 'Above error occurred while executing the following:'
print command
##########

The problem lies in that the second time the application is run, it
doesn't grab focus and go full screen, but sits paused. It will not
continue running until I click on the minimized application in the
taskbar. Is there any way to force it to grab focus?

I am running on Win32 with Python 2.5.1.

Your help in this matter is greatly appreciated,
Mick Charles Beaver
 
K

kyosohma

Hello,

I need to run a particular graphics application over and over again
with a different command line to get benchmarks on the applications
performance (frame rates and similar data). I am running the following
within a while loop that parses out a different command line from a
configuration file.

############
def runCommand(command):
"""runCommand(command)

Parameters:
command -- the full string of the command to execute

"""
print command
try:
childProcess = subprocess.Popen(command)

done = False
while not done:
returnCode = childProcess.poll()
if (returnCode != None):
done = True
else:
# sleep for 10 seconds before checking again
time.sleep(10)
except KeyboardInterrupt:
print 'KeyboardInterrupt received. Trying to kill Wolf2.exe'
print '>TASKKILL /F /T /PID ', childProcess.pid
killCommand = ''.join(('TASKKILL /F /T /PID ',
str(childProcess.pid)))
killSubProcess = subprocess.Popen(killCommand)
killSubProcess.wait()
sys.exit(0)
except OSError, (errno, strerror):
print 'OS Error (%s): %s' % (errno, strerror)
print 'Above error occurred while executing the following:'
print command
except WindowsError, (errno, strerror):
print 'MS Windows Error (%s): %s' % (errno, strerror)
print 'Above error occurred while executing the following:'
print command
##########

The problem lies in that the second time the application is run, it
doesn't grab focus and go full screen, but sits paused. It will not
continue running until I click on the minimized application in the
taskbar. Is there any way to force it to grab focus?

I am running on Win32 with Python 2.5.1.

Your help in this matter is greatly appreciated,
Mick Charles Beaver


If your graphics program uses COM you may be able to do something like
what's done in the following post:

http://mail.python.org/pipermail/python-list/2005-June/327261.html

I found this too, but I haven't tested it myself: http://downgra.de/articles/python-wmii/

You may be able to use Tim Golden's WMI module too. I would think you
could use his "enumerate all running processes" and combine it with
the "run a process minimized", except you'd change the flag so that it
maximized instead. See link below:

http://tgolden.sc.sabren.com/python/wmi_cookbook.html

Hopefully that'll help you some.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top