I download my Python 2.7 with Anaconda. I'm using windows 7. I tried following:
from Tkinter import Tk, Frame, Canvas
import ImageTk
t = Tk()
t.title("Transparency")
frame = Frame(t)
frame.pack()
canvas = Canvas(frame, bg="black", width=500, height=500)
canvas.pack()
photoimage = ImageTk.PhotoImage(file=r"test.png")
canvas.create_image(150, 150, image=photoimage)
t.mainloop()
I get following Error:
ImportError: No module named _imagingtk
I think I need to install ImageTk, how this ImportError: No module named _imagingtk says.
But how can I install it on Windows? Where should I type this code?
$ pip install ImageTk
If I try:
import ImageTk
I don't get any Error. What means ImageTk is actually already installed, right?
Thanks
ImageTk is defined in the package PIL which you should install with:
pip install Pillow
Pillow is a port of PIL that is accessible through pip. Now import PIL like so:
from PIL import ImageTk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With