Advertisement
john_feleppa

GUIs 3.6

Aug 21st, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 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.  
  24. for picture in pictures:
  25. picture.image = emojis[0]
  26. del emojis[0]
  27.  
  28. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement