I am running python 32bit 3.8.4 on Windows 10
I installed pillow with, pip install Pillow but python does not like this
and returns PIL not found
Pillow documentation suggests I should use
but what syntax should I use in this line ?
Any help appreciated
I installed pillow with, pip install Pillow but python does not like this
and returns PIL not found
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from tkinter import * from PIL import ImageTk,Image #Tried this as well #from pillow.Image import core as _imaging root = Tk() num = 0 canvas = Canvas(root, width = 1920 , height = 1080 ) img_0 = ImageTk.PhotoImage(Image. open ( "Photo (1).jpg" )) img_1 = ImageTk.PhotoImage(Image. open ( "Photo (50).jpg)" )) def task(): global num canvas.delete( "all" ) canvas.create_text( 20 , 20 , text = "loop " + str (num)) if num % 2 = = 0 : canvas.create_image( 20 , 40 , anchor = NW, image = img_0) if num % 2 = = 1 : canvas.create_image( 20 , 40 , anchor = NW, image = img_1) num + = 1 root.after( 2000 , task) # reschedule event in 2 seconds canvas.pack() canvas.create_text( 20 , 20 , text = "hello" ) root.after( 2000 , task) root.mainloop() |
1 |
from pillow.Image import core as _imaging |
1 |
img_0 = ImageTk.PhotoImage(Image. open ( "Photo (1).jpg" )) |