Change Tkinter Frame Title

user3798654 picture user3798654 · Nov 10, 2015 · Viewed 59.8k times · Source

I am trying to figure out how to change the title of a Tkinter Frame. Below is simplified code that mimics the portion of my program where I am trying to change the title:

from Tkinter import *

class start_window(Frame):
    def __init__(self, parent=None):
        Frame.__init__(self, parent)
        Frame.pack(self)
        Label(self, text = 'Test', width=30).pack()

if __name__ == '__main__':
    start_window().mainloop()

With this sample code the Frame has the standard "tk" title but I would like to change it to something like "My Database". I've tried everything I can think of with no success. Any help would be appreciated.

Answer

letsc picture letsc · Nov 10, 2015

Try this:

if __name__ == '__main__':
    root = Tk()
    root.title("My Database")
    root.geometry("500x400")
    app = start_window(root)
    root.mainloop()