I cant seem to find the right way to make a random image appear in a window (im using tk for the window), so every second a new random image from a folder appears. Haven't found a tutorial that works. this is what ive got so far but dont know how to display the image in the window:
any help would be very appreciated!
just for reference, Im using python3 on Linux
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import os from Tkinter import * from PIL import ImageTk, Image import random #the window window = Tk() window.title( 'Johnny' ) window.geometry( "300x200+10+20" ) window.configure(background = 'black' ) # end of window settings, content goes next: count = 1 while count < 20 : path = "/home/david/Desktop/Johnny/Assets" files = os.listdir(path) d = random.choice(files) window.mainloop() |
just for reference, Im using python3 on Linux