Menu

I Am Using Python And Tries To Write A Main Function That Calls Three Other Func

I am using python and tries to write a main function that calls three other functions and display three picture effects. The three functions I use are to lighten, darken and grayscale the original picture. But when I wanted them to show simultaneously in the main function, only one picture is shown instead of three(I used the program below). Do I necessarily need to copy three pictures to a canvas?

def main(picture):

 show(lighten(picture))

 show(darken(picture))

 show(grayscale(picture))

def lighten(picture):

 for px in getPixels(picture):

  color=getColor(px)

  color=makeLighter(color)

  setColor(px,color)

 return picture

def darken(picture):

 for px in getPixels(picture):

  color=getColor(px)

  color=makeDarker(color)

  setColor(px,color)

 return picture

def grayscale(picture):

 for px in getPixels(picture):

  intensity=(getRed(px)+getBlue(px)+getGreen(px))/3

  setColor(px,makeColor(intensity,intensity,intensity))

 return picture

Leave a Reply

Your email address will not be published. Required fields are marked *