Python 3 Pillow Multiple Image Looping Slideshow in Movie Video Presentation Script Full Project For Beginners

Python 3 Pillow Multiple Image Looping Slideshow in Movie Video Presentation Script Full Project For Beginners

 

Welcome folks today in this post we will be building a llooping image slideshow from multiple images in the form of short movie video using pillow library in python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install pillow

 

After installing this library make an app.py file and copy paste the following code

 

app.py

 

# import required modules 
import tkinter as tk 
from tkinter import *
from PIL import Image 
from PIL import ImageTk 



# adjust window 
root=tk.Tk() 
root.geometry("200x200") 

# loading the images 
img=ImageTk.PhotoImage(Image.open("sample1.png")) 
img2=ImageTk.PhotoImage(Image.open("sample2.png")) 
img3=ImageTk.PhotoImage(Image.open("sample3.png")) 

l=Label() 
l.pack() 



# using recursion to slide to next image 
x = 1

# function to change to next image 
def move(): 
    global x 
    if x == 4: 
        x = 1
    if x == 1: 
        l.config(image=img) 
    elif x == 2: 
        l.config(image=img2) 
    elif x == 3: 
        l.config(image=img3) 
    x = x+1
    root.after(2000, move) 

# calling the function 
move() 



root.mainloop()

 

See also  Python 3 PyQt5 Rock Paper Scissors Game Script Using Random Module GUI Desktop App Full Project For Beginners

 

Here you need to replace the paths of the images that are there inside the above script and then run the python script using the below command

 

python app.py

 

 

 

Leave a Reply