CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

Label image white border

Open N4GR opened this issue 6 months ago • 1 comments

Hello everyone, I've got a little on-going project of mine that I'm working on and I came across an issue that I'm unaware of a fix for - I've created a transparent window and am attempting to place an image label onto it to act like the background of the window; however, when attempting to do so there's this white, pixelated-like fuzzy border around the edges of the image; any help will be appreciated.

code:

class ui():
    def __init__(self) -> None:
        # Creating root window
        main_window = Win()
        #windll.shcore.SetProcessDpiAwareness(1)

        main_window.configure(bg = "white")
        main_window.attributes("-transparentcolor", "white")
        main_window.geometry(f"{WINDOW_WIDTH}x{WINDOW_HEIGHT}")

        # Creating main canvas
        main_canvas = tk.Canvas(
            master = main_window,
            height = WINDOW_HEIGHT,
            width = WINDOW_WIDTH,
            bd = 0,
            highlightthickness = 0,
            relief = "ridge"
        )
        main_canvas.place(x = 0, y = 0)

        # Applying root window background
        image = ctk.CTkImage(Image.open("assets/background.png"), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
        
        background_image = ctk.CTkLabel(master = main_canvas, image = image, bg_color = "white", text = "")
        background_image.place(x = 0, y = 0)

        main_window.mainloop()

Resulting window sample with issue: image

Original image sample: image

N4GR avatar Jul 31 '24 09:07 N4GR