import os from random import shuffle from guizero import App, Box, Picture # set the path to the emoji folder on your computer emojis_dir = "emojis" # create a list of the locations of the emoji images emojis = [os.path.join(emojis_dir, f) for f in os.listdir(emojis_dir) if os.path.isfile(os.path.join(emojis_dir, f))] # shuffle the emojis shuffle(emojis) app = App("emoji match") # create a box to house the grid pictures_box = Box(app, layout="grid", border=True) # create an empty list to which pictures will be added pictures = [] for x in range(0,4): for y in range(0,4): # put the pictures into the list picture = Picture(pictures_box, grid=[x,y]) pictures.append(picture) idx = -1 for picture in pictures: # make the picture a random emoji picture.image = emojis[idx] idx = idx - 1 app.display()