Discover the answers you need at Westonci.ca, where experts provide clear and concise information on various topics. Discover reliable solutions to your questions from a wide network of experts on our comprehensive Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
PLEASE HELP ME FIX THIS CODE.
I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.
user_color = input("What color would you like to paint the canvas, blue, red or green?:")
def user_red(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_green(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def user_blue(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]
return pixel
def custom_filter(image, user_color):
for x in range(image.get_width()):
for y in range(image.get_height()):
pixel = image.get_pixel(x,y)
new_colors = invert_pixel(pixel)
image.set_red(x, y, new_colors[0])
image.set_green(x, y, new_colors[1])
image.set_blue(x, y, new_colors[2])
return image
def change_image():
global image
image = custom_filter(image, user_color)
timer.set_timeout(change_image, IMAGE_LOAD_TIME)
We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Your visit means a lot to us. Don't hesitate to return for more reliable answers to any questions you may have. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.