0

I have a list of some images and I am tring to display them in a label randomly. But all I can see is the background color of my Label where the images should be. Here is my code..

import random
import time
from tkinter import *
wn=Tk()
wn.geometry("500x300")

def displayPic():
    list1 = ["pic1.png", "pic2.png", "pic3.png", "pic4.png", "pic5.png", "pic6.png"]
    myPic = random.choice(list1)
    imag1 = PhotoImage(file="pic1.png")# here is where ı confuse..
    lb1 = Label(wn, bg="pink", text="", image=imag1)
    lb1.place(x=100, y=10)



    wn.after(1000, displayPic)

btn1 = Button(text="SHOWme",command=displayPic)
btn1.place(x=100,y=200)



wn.mainloop()
gencoglu17
  • 45
  • 7

0 Answers0