python - CardDeck Function flip() for GUI -


i'm stuck on flip() function have create. flipper_app initializes 3 cards in deck showing side. define card.display('back') cardlabel.py card images processed in py file. each time flip function(button) pressed, card flips front side. press again, second card showing front. third press have cards showing front. fourth click should remove first card deck, second, third until cards gone.

i can't seem implement these orders in 1 function. can seem flip them all, instead of flipping them 1 one. how can create method above?

here's code:

%gui tk import tkinter tk random import randint cardlabel import cardlabel cardlabel  flipper_app = tk.tk() cardlabel.load_images()  label = cardlabel(flipper_app) label.grid(row=0, column = 0) label.display('back')  label_2 = cardlabel(flipper_app) label_2.grid(row = 0, column = 1) label_2.display('back')  label_3 = cardlabel(flipper_app) label_3.grid(row = 0, column = 2) label_3.display('back')  def flip():     labels = [label, label_2, label_3]      labels[0].display('front', randint(0,51))     flipper_app.update_idletasks()  flip_button = tk.button(flipper_app, text='flip', command= flip)  flip_button.grid(row=1, column=1, columnspan=1, pady = 20) 


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -