def test_getters_setters(): a = App() p = Picture(a) assert p.image == None p.image = "../examples/guizero.gif" assert p.image == "../examples/guizero.gif" assert p._image.tk_image is not None p.width = 100 assert p.width == 100 p.height = 100 assert p.height == 100 a.destroy()
buttons = [] pictures = [] # create 9 PushButtons with a different grid coordinate and add to the list for x in range(0, 3): for y in range(0, 3): # put the pictures and buttons into the lists picture = Picture(pictures_box, grid=[x, y]) pictures.append(picture) button = PushButton(buttons_box, grid=[x, y]) buttons.append(button) # for each picture and button in the list assign an emoji to its image feature for picture in pictures: # make the picture a random emoji picture.image = emojis.pop() for button in buttons: # make the image feature of the PushButton a random emoji button.image = emojis.pop() # import the randint function from random import randint # choose a new emoji matched_emoji = emojis.pop() # select a number at random random_picture = randint(0, 8) # change the image feature of the Picture with this index in the list of pictures to the new emoji pictures[random_picture].image = matched_emoji