I need to make my tkinter rectangles transparent. Does anyone know how to do that?
I have tried to specify alpha=".5", opacity=".5"
, and I have tried to add two more digits in the end of the color code: fill="#ff000066"
. None of these things seem to work, I can't find the right syntax.
import tkinter
root = tkinter.Tk()
canvas = tkinter.Canvas(root, width=800, height=600)
canvas.pack()
canvas.create_rectangle(50, 50, 100, 100, fill="#ff0000", alpha=0.5)
root.mainloop()
This code gives me this message: _tkinter.TclError: unknown option "-alpha"
, so this is obviously not the right way to do it.