0

I need the background of the photo to be transparent; below is my code:

from tkinter import *
from PIL import ImageTk,Image
root=Tk()
root.geometry("300x300")
root.configure(bg="yellow")
image=Image.open("zombie.png")
image=image.resize((50,50))
img=ImageTk.PhotoImage(image)

canvas=Canvas(width=150, height=100,borderwidth=3,bd=0)
canvas.create_image(50,50,image=img)
canvas.pack()
root.mainloop()
GRU119
  • 1,028
  • 1
  • 14
  • 31
  • Does this answer your question? [How to make a tkinter canvas background transparent?](https://stackoverflow.com/questions/53021603/how-to-make-a-tkinter-canvas-background-transparent) – Mike - SMT Mar 09 '20 at 19:32
  • tkinter canvas cannot has transparent background. Can you use the canvas as the background (instead of `root`) and put transparent PNG images on it? – acw1668 Mar 10 '20 at 00:47

1 Answers1

0

You can find more information here for a more detailed explanation of making transparent background. This could be a starting point.

GRU119
  • 1,028
  • 1
  • 14
  • 31