在我的程序中,我试图在图像上叠加不同的画布几何图形。但是,我的问题是画布本身有一种颜色可以阻挡大部分图像。如何使此画布透明,以便只显示我绘制的几何图形?这是我的代码,以防我的解释不够。
#!/usr/bin/python
import tkinter
from tkinter import *
from PIL import Image, ImageTk
root = Tk()
root.title("Infrared Camera Interface")
root.resizable(width=FALSE, height=FALSE)
class MyApp:
def __init__(self, parent):
#Set the dimensions of the window
parent.minsize(width=600, height=600)
parent.maxsize(width=600, height=600)
#Prepare the image object being loaded into the stream camera
self.imgName = 'Dish.png'
self.img = Image.open(self.imgName)
self.img = self.img.resize((560, 450), Image.ANTIALIAS)
#Display the image onto the stream
self.displayimg = ImageTk.PhotoImage(self.img)
self.imglabel = Label(root, image=self.displayimg).place(x=0, y= 0)
self.C = tkinter.Canvas(root, bg="white", height=560, width=450)
coord = 10, 50, 240, 210
arc = self.C.create_arc(coord, start=0, extent=150, fill="red")
self.C.pack()
myapp = MyApp(root)
root.mainloop()