full screen graphics

kyosohma at gmail.com kyosohma at gmail.com
Mon May 21 11:23:50 EDT 2007


On May 21, 8:39 am, myheartinamerica <myheartinamer... at 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/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





More information about the Python-list mailing list