Advertisement
timber101

Emoji4x4 and no POP

Aug 16th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. import os
  2. from random import shuffle
  3. from guizero import App, Box, Picture
  4.  
  5. # set the path to the emoji folder on your computer
  6. emojis_dir = "emojis"
  7. # create a list of the locations of the emoji images
  8. emojis = [os.path.join(emojis_dir, f) for f in os.listdir(emojis_dir) if os.path.isfile(os.path.join(emojis_dir, f))]
  9. # shuffle the emojis
  10. shuffle(emojis)
  11.  
  12. print(len(emojis))
  13.  
  14. #print(emojis) - testing shuffling works
  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[1]
  33.     emojis.remove(emojis[1])##emojis.pop()##
  34.  
  35. print(len(emojis))
  36.  
  37. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement