python: simple boolean variable declaration after for loop isn't working -
i think title says here's code:
for x in range(2, 10): my_button.push(button(10+50*x,470,45,20,(128,64,224),"button ".join(chr(48+x))) ispressed = false
and result:
jdd:my project me$ python testbutton1.py file "testbutton1.py", line 81 ispressed = false ^
i'm still learning , syntax can sneaky in language. not know. i'm not seeing did wrong. loop creating , pushing button objects onto linked list.
as far case syntax errors, problem on line preceding error. you're missing close parenthesis here:
my_button.push(button(10+50*x,470,45,20,(128,64,224),"button ".join(chr(48+x))) ) # added ---^
it's possible (and unknowable you), close parenthesis needs somewhere other end of line
frankly, it'd nice if python included effect in traceback. like:
syntax error on line 2 of statement inside parenthetical
these errors crop far often, , error misleading. , it's not rookie mistake. (we forget close parentheses time time
Comments
Post a Comment