There was an old PIL library for image manipulation in python2. Pillow is newer fork of it, written in python3. So library is pillow, but "import PIL ..." for compatibility))
Note: When a PhotoImage object is garbage-collected by Python (e.g. when you return from a function which stored an image in a local variable), the image is cleared even if it’s being displayed by a Tkinter widget. To avoid this, the program must keep an extra reference to the image object. A simple way to do this is to assign the image to a widget attribute, like this: label = Label(image=photo) label.image = photo # keep a reference! label.pack() This is alternative way to do it instead of using global variable.
Very good video Was looking for long time I have a question I have a folder with 25 photos. I want the images with even number must come in canvas A and the images with odd numbers must come in canvas B. Can you make a video or help me to code that Waiting for your reply
If your photos are named like 1.png 2.png etc then you could just loop through the images and do something like If int(image_name[0]) % 2 == 0 then it’s even and you know to display it in canvas A. Otherwise, display it in canvas B. Something like that. Essentially, extract the number from the filename and do mod 2 in order to see if it’s even or odd.