Warm tip: This article is reproduced from serverfault.com, please click

Tkinter Cant remove image lines

发布于 2020-11-27 11:19:32

This is my code:

from tkinter import *
from PIL import ImageTk, Image

root = Tk()
root.configure(background = 'red')
root.geometry("400x480")
img = ImageTk.PhotoImage(Image.open("box.png"))
panel = Label(root, image = img)
panel.pack()

It shows the icon BUT it shows the icon with white lines on the edge:

Check here

So is there any way to remove those lines or atleast change the color?

Questioner
Somebody
Viewed
0
Somebody 2020-11-29 16:48:12

Thank you Flavio Moraes for giving me the answer! using border=0 removes the lines from the image like this

    panel = Label(root, image = img, border=0)

again thank you