Python Identation error -
i cant figure out wrong code..it showing error: "unindent doesnt match outer indentation level have checked using python -m tabnanny paint.py...it showing this: "identation error: unident not match outer level((tokensize>,line26>" can't understand what say..please me. #paint.py import sys,pygame import os pygame.locals import *
pygame.init() screen = pygame.display.set_mode((1000,600)) screen.fill((255,255,255)) brush = pygame.image.load(os.path.join('c:\python27','brush.png')) brush = pygame.transform.scale(brush,(128,128)) pygame.display.update() clock = pygame.time.clock() z = 0 while 1: clock.tick(60) x,y = pygame.mouse.get_pos() event in pygame.event.get(): if event.type==pygame.quit: sys.exit() elif event.type == mousebuttondown: z=1 elif event.type == mousebuttonup: z=0 if z==1: screen.blit(brush,(x-64,y-64)) pygame.display.update()
there several places missing indentation:
... if event.type==pygame.quit: sys.exit() # <-- missing indentation elif event.type == mousebuttondown: z=1 # <-- missing indentation elif event.type == mousebuttonup: z=0 # <-- missing indentation ....
note block executed under if
clause must indented. recommend use text editor can show white chars - difficult catch these errors otherwise.
Comments
Post a Comment