0

I've created a bordeless window using tkinter and I was wondering if there was a way to change the shape into a rounded rectangle? As well as make buttons rounded too? Here is my current code:

from tkinter import *
import tkinter as tk


root = tk.Tk()
root.overrideredirect(1)
window_width = root.winfo_reqwidth()
window_height = root.winfo_reqheight()
print("Width", window_width, "Height", window_height)
# Change the position of the window on screen
position_right = int(root.winfo_screenwidth() / 2 - window_width / 2)
position_down = int(root.winfo_screenheight() / 2 - window_height / 2)
root.geometry("+{}+{}".format(position_right, position_down))
# Change how it looks look into changing the shape and any animations we could add
frame = Frame(root, width=500, height=150,
                           borderwidth=2, relief=RAISED, bg="#0D0E50")
frame.pack_propagate(False)
frame.pack()
b_minimize = Button(frame, text="<", height=10, bg="light blue", fg="white", borderwidth=1, command=root.quit())
b_minimize.place(x=0, y=0)


root.mainloop()
  • 1
    Like this? https://stackoverflow.com/questions/44099594/how-to-make-a-tkinter-canvas-rectangle-with-rounded-corners – Keivan Nov 15 '20 at 20:49
  • No, it's not possible to change the window shape. However in Windows you can set a specific color to be transparent, so if you make the edges that color it will look like it's a different shape. To make rounded Buttons you would have to make the Button widgets yourself from images. – Novel Nov 15 '20 at 20:50

1 Answers1

1

Hi i think this could help you:

Different shapes of windows in tkinter

Non-standard windows with Tkinter?

An easy way to change button style is the usage of pictures!

grumpyp
  • 432
  • 4
  • 10