2

So Basically I want to make a window without the window border at the top visible and to be able to move the window by grabbing the border of the GUI box. I have been able to make exit and minimize buttons but I just need to figure out how to move the window.

Here's the window border I was talking about earlier:

Window Border I want to remove

And here is like some concept art of what I am trying to do.

Concept Art

Here is the code I have so far

import tkinter as tk

root = tk.Tk()

# Set Screen Resolution
window_width = int(root.winfo_screenwidth() / 2)
window_height = int(root.winfo_screenheight() / 2)
screen_resolution = str(window_width) + "x" + str(window_height)
root.geometry(screen_resolution)

# Side Taskbar
side_taskbar = tk.Label(root, bg="#262730", width=int(window_width / 25), height=window_height)
side_taskbar.pack()
side_taskbar.place(x=0)

# Exit Button
close_button_icon = tk.PhotoImage(file="./Icons/close_button.png")
close_button_icon_width = 16
close_button_icon_height = 16
close_button_icon = close_button_icon.subsample(32, 32)
close_button = tk.Button(
    root,
    image=close_button_icon,
    command=root.quit,
    width=close_button_icon_width,
    height=close_button_icon_height,
    highlightthickness=0,
    bd=0
)
close_button.pack()
close_button.place(x=5,y=5)

# Minimize Button
minimize_button_icon = tk.PhotoImage(file="./Icons/minimize_button.png")
minimize_button_icon_width = 16
minimize_button_icon_height = 16
minimize_button_icon = minimize_button_icon.subsample(32, 32)
close_button = tk.Button(
    root,
    image=minimize_button_icon,
    command=root.withdraw,
    width=minimize_button_icon_width,
    height=minimize_button_icon_height,
    highlightthickness=0,
    bd=0
)
close_button.pack()
close_button.place(x=30,y=5)

root.configure(bg="#32323D")
root.overrideredirect(1)
root.mainloop()
Geo
  • 21
  • 1
  • I think you may be looking for this: https://stackoverflow.com/questions/4055267/tkinter-mouse-drag-a-window-without-borders-eg-overridedirect1 – BazzerDv Oct 03 '22 at 16:54

0 Answers0