pythonmatplotlib

Change figure window title in pylab


How can I set a figure window's title in pylab/python?

fig = figure(9) # 9 is now the title of the window
fig.set_title("Test") #doesn't work
fig.title = "Test" #doesn't work

Solution

  • If you want to actually change the window you can do:

    fig = pylab.gcf()
    fig.canvas.set_window_title('Test')
    

    Update 2021-05-15:

    The solution above is deprecated (see here). instead use

    fig = pylab.gcf()
    fig.canvas.manager.set_window_title('Test')