I wish to create a loop which adds images across a screen with random positions:

photo1 = PhotoImage(file=address) #Assign image to PhotoImage
    XValue = randint(0,widthOfScreen-width2) #width2 = image width
    YValue = randint(0,heightOfScreen-height2) #width2 = image height
    Label(mainGUI, background = "white", image = photo1, borderwidth = 0).place(x=XValue, y = YValue)

the code works and places the objects randomly but if i try and add a

time.sleep(1)

into the loop then the gui isnt made until the ned of the program with all images finished....

Actually you can use time.sleep() with Tkinter but you have to use update() too ...

''' tk_image_slideshow_sleep.py
create a very simple Tkinter image slide show
using time.sleep() and root.update()
tested with Python27/33  by  vegaseat  03dec2013
'''

import time
try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

# get a series of gif images you have in the working folder
# or use full path name
image_files = [
'Slide_Farm.gif',
'Slide_House.gif',
'Slide_Sunset.gif',
'Slide_Pond.gif',
'Slide_Python.gif'
]

root = tk.Tk()
label = tk.Label(root)
label.pack()

delay = 3.2  # seconds delay between slides
for image in image_files:
    image_object = tk.PhotoImage(file=image)
    label.config(image=image_object)
    root.title(image)
    root.update()
    time.sleep(delay)

root.mainloop()
Comments
Very helpful
This question has already been answered. Start a new discussion instead.