Advertisement
xavicano

Untitled

Aug 20th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. import os
  2. from random import shuffle
  3. from guizero import App, Box, Picture
  4. # set the path to the emoji folder on your computer
  5. emojis_dir = "C:\\Users\\xavi.cano\\Code\\emojis\\emojis"
  6.  
  7.  
  8. # create a list of the locations of the emoji images
  9. emojis = [os.path.join(emojis_dir, f) for f in os.listdir(emojis_dir) if os.path.isfile(os.path.join(emojis_dir, f))]
  10.  
  11.  
  12. # shuffle the emojis
  13. shuffle(emojis)
  14.  
  15.  
  16. app = App("emoji match")
  17. # create a box to house the grid
  18. pictures_box = Box(app, layout="grid")
  19.  
  20. # create an empty list to which pictures will be added
  21. pictures = []
  22. for x in range(0,4):
  23.     for y in range(0,4):
  24.         # put the pictures into the list
  25.         picture = Picture(pictures_box, grid=[x,y])
  26.         pictures.append(picture)
  27.  
  28.  
  29. ## for each picture in the list
  30. #for picture in pictures:
  31.     ## make the picture a random emoji
  32.     #picture.image = emojis.pop()
  33.  
  34.  
  35. for picture in pictures:
  36.     ## make the picture a random emoji
  37.     picture.image = emojis[0]
  38.     del emojis[0]
  39.  
  40. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement