python - nested defs not working -
what need add second def statement in order work?
def main(): # user has choose picture , asked pic = makepicture(pickafile()) # user asked select color wants remove picture color = requeststring("which color remove?") show(pic) # whats wrong last part doesn't make modifications picture def removecolor(pic, color): r = red g = green b = blue px in getpixels(pic): setred(px, 0) px in getpixels(pic): setgreen(px, 0) px in getpixels(pic): setblue(px, 0) repaint(pic)
here take out removecolor
function main
function, , call inside main
def removecolor(pic, color): r = red g = green b = blue px in getpixels(pic): setred(px, 0) px in getpixels(pic): setgreen(px, 0) px in getpixels(pic): setblue(px, 0) def main(): # user has choose picture , asked pic = makepicture(pickafile()) # user asked select color wants remove picture color = requeststring("which color remove?") show(pic) removecolor(pic, color) # here i'm calling removecolor repaint(pic)
Comments
Post a Comment