izmeina: a snippet of Escher's circle of serpents (Default)
izmeina ([personal profile] izmeina) wrote 2014-10-25 04:37 pm (UTC)

I can get the mouse handler to print the index number of any card that I click on and have all the shuffled card numbers lined up neatly in a row. But I am completely clueless at how to link the index number in the mouse handler to the index number in the exposed list which means there's no way to flip the cards over or back

So not sure how this copies in this comment bar but here's the contents of the draw handler

def draw(canvas):
# draw lines on canvas
card_pos[0] = 0
for card in deck:

canvas.draw_line([card_pos[0], 0],[card_pos[0], HEIGHT], 2, "White")
card_pos[0] += 50


# Make unexposed cards green
# card_pos[0] = 25
# for card in deck:

# canvas.draw_line([card_pos[0], 0],[card_pos[0], HEIGHT], 50, "Green")
# card_pos[0] += 50


card_pos[0] = 20
card_pos[1] = 60
for d in deck:
canvas.draw_text(str(d), card_pos, 40, "Green")
card_pos[0] += 50


Every attempt at bringing in the logic of
if exposed = false - make card green or
if exposed is true - draw number from deck

results in a total disaster. So figured the best thing to do is to forget about the green and just leave the numbers exposed. At least that way I can prove I could produce them and shuffle them and that they get reshuffled whenever the reset button is clicked.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org