i'm having trouble if statement inside while loop.
while pressed == 8 : print(answerlistx[randomimage], answerlisty[randomimage]) entryx = e1.get() entryy = e2.get() answerx = answerlistx[randomimage] answery = answerlisty[randomimage] print(entryx, entryy) if e1 == answerx , e2 == answery: print("correct") canvas.delete(images) randomimage = random.randrange(0,49+1) scorecounter = scorecounter + 1 game = photoimage(file=imagelist[randomimage]) images = canvas.create_image(30, 65, image = game, anchor = nw) e1.delete(0, end) e2.delete(0, end) pressed = '' else: print("incorrect") e1.delete(0, end) e2.delete(0, end) pressed = '' the while loop supposed check see if inputs entry widget match the answer when answer correct goes else statement. have 2 print statements before if statement prints input , answer incase didn't have display both correctly. thought might have been mix strings , integers changed answers in answerlist strings no luck. able figure out wrong it? in advance.
you testing if entry objects same answers. use actual values:
if entryx == answerx , entryy == answery: instead of testing against e1 , e2.
Comments
Post a Comment