By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,091 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,091 IT Pros & Developers. It's quick & easy.

full screen graphics

P: n/a
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

May 21 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On May 21, 8:39 am, myheartinamerica <myheartinamer...@gmail.com>
wrote:
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/pyt...ne/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
May 21 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.