0

I have made an calculator in python using tkinter but:

Title bar of my Calculator

Title bar of Windows calculator

I want to make it look like the Windows one

D_00
  • 1,312
  • 2
  • 11
  • 31
AS....
  • 1
  • 2
  • 1
    Check [this](https://stackoverflow.com/questions/23836000/can-i-change-the-title-bar-in-tkinter) It has answers here. –  May 08 '21 at 04:43

1 Answers1

1

Here is how you can make a custom title bar:

import tkinter as tk

root = tk.Tk()

def move_window(event):
    root.geometry('+{0}+{1}'.format(event.x_root, event.y_root))

root.overrideredirect(True) # turns off title bar, geometry
root.geometry('400x100+200+200') # set new geometry

# make a frame for the title bar
title_bar = tk.Frame(root, bg='blue', relief='raised', bd=2) # enter your colour here

# put a close button on the title bar
close_button = tk.Button(title_bar, text='X', command=root.destroy)

# a canvas for the main area of the window
window = tk.Canvas(root, bg='black')

# pack the widgets
title_bar.pack(expand=1, fill="x")
close_button.pack(side="right")
window.pack(expand=1, fill="both")

# bind title bar motion to the move window function
title_bar.bind('<B1-Motion>', move_window)

root.mainloop()
ani
  • 190
  • 2
  • 12