I came across question http://stackoverflow.com/questions/6485678/ which has to do with setting the console title from sitecustomize.py. With some help from the folks on python-win32 (for the title portion ;) I came up with this:

8<-- sitecustomize.py ---------------------------------
import sys
import time
from ctypes import windll

class SetTitle(object):
    def __del__(self):
        time.sleep(.1)
        command = ' '.join(sys.argv)
        windll.kernel32.SetConsoleTitleA(command)

sys.argv = SetTitle()
8<-----------------------------------------------------

I have a good number of python scripts being called to perform work, and even the GUI modules have a console window -- no, it's not very polished, but it's internal use only and it make the occasional bug easier to track.

Having the python script's name in the console window (which otherwise just says something like 'c:\windows\cmd.exe') is quite nice.

Oh, and if you're using Python 3, change SetConsoleTitleA to SetConsoleTitleW.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to