How to round up edges of main window? #684
-
Is there any way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
You can round up the edges of frame, as far as i know it's not possible on your main window. |
Beta Was this translation helpful? Give feedback.
-
@Nikushavar No, the main window is controlled by your OS, not tkinter/customtkinter. All the windows are round in windows 11, ubuntu or mac. If you are on windows 10 then no chance. |
Beta Was this translation helpful? Give feedback.
-
@Nikushavar There is one technique by which you can make round looking window even in windows 10, It will look like this: Code:import customtkinter
def move_window(event): # Moving the window
root.geometry(f'+{event.x_root}+{event.y_root}')
def close_window(): # Closing the window
root.destroy()
root = customtkinter.CTk()
root.geometry("400x200") # Main window geometry
root.overrideredirect(1) # Removes the main window
root.config(background='#000001')
root.attributes("-transparentcolor", '#000001') # '#000001' will be the transparent color
root.bind("<B1-Motion>", move_window)
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(0, weight=1)
frame_1 = customtkinter.CTkFrame(root, corner_radius=30, width=400, bg_color='#000001')
frame_1.grid(sticky="nswe") # Main round frame, adjust corner_radius
frame_1.grid_columnconfigure(0, weight=1)
frame_1.grid_rowconfigure(0, weight=1)
button_1 = customtkinter.CTkButton(frame_1, corner_radius=20, width=1, text="X", command=close_window)
button_1.grid(sticky="ne", padx=20, pady=20) # Button that will close the window (as the close protocol is hidden)
label_1 = customtkinter.CTkLabel(frame_1, width=1, text="This is a CustomTkinter App")
label_1.place(x=20, y=20) # Other widgets
# Place other widgets in the frame_1 as usual
root.mainloop() Though there will be some limitations like no application title, resizable options etc. It is also recommended to use place method for the widgets. |
Beta Was this translation helpful? Give feedback.
@Nikushavar No, the main window is controlled by your OS, not tkinter/customtkinter. All the windows are round in windows 11, ubuntu or mac. If you are on windows 10 then no chance.