Advertisement
akiyama43

Untitled

Aug 18th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 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. app = App("emoji match")
  13. # create a box to house the grid
  14. pictures_box = Box(app, layout="grid")
  15.  
  16. # create an empty list to which pictures will be added
  17. pictures = []
  18. for x in range(0,4):
  19.     for y in range(0,4):
  20.         # put the pictures into the list
  21.         picture = Picture(pictures_box, grid=[x,y])
  22.         pictures.append(picture)
  23.         picture.image =emojis.pop()
  24.  
  25. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement