How to set the program title in python

Since your program is interpreted by Python, then what actually is run is Python itself - the interpreter program. You would have to have your Python script merged with Python into a single executable and that would be able to have a separate name. For windows there is py2exe, that does that, but I have no idea if there is a similar tool for Mac OS (and if there is any need for that, there is some BSD under the hood right?).


It depends on what type of application you have. If it's a graphical application, most graphical toolkits allow you to change the title of a window (tk, which comes with python, allows you to do this by calling the title() method of your window object, as does gtk, for which you can use the set_title() method on a Gtk.Window object)

If you're talking about changing the title of the terminal window (for mac or Linux), the you have this option (from here):

import sys
sys.stdout.write("\x1b]2;Another Title\x07")

For Windows, there's a different method:

import os
os.system("title Yet Another Title")