how to change the title bar color in tkinter

Solutions on MaxInterview for how to change the title bar color in tkinter by the best coders in the world

showing results for - "how to change the title bar color in tkinter"
Isabel
07 Jan 2019
1root = Tk()
2
3def move_window(event):
4    root.geometry('+{0}+{1}'.format(event.x_root, event.y_root))
5
6root.overrideredirect(True) # turns off title bar, geometry
7root.geometry('400x100+200+200') # set new geometry
8
9# make a frame for the title bar
10title_bar = Frame(root, bg='white', relief='raised', bd=2)
11
12# put a close button on the title bar
13close_button = Button(title_bar, text='X', command=root.destroy)
14
15# a canvas for the main area of the window
16window = Canvas(root, bg='black')
17
18# pack the widgets
19title_bar.pack(expand=1, fill=X)
20close_button.pack(side=RIGHT)
21window.pack(expand=1, fill=BOTH)
22
23# bind title bar motion to the move window function
24title_bar.bind('<B1-Motion>', move_window)
25
26root.mainloop()