Looping Menu

imagegram.py: 38 points


We’ll start by implementing the menu for your program. Your program should begin by printing a welcome to the user. You should then prompt the user in the console to enter the name of a file to load. You should use a try-except block to make sure that the file exists – if a FileNotFoundError occurs, you should print a message to the user letting them know that the file with the provided name does not exist.

Once you have an image loaded, display it. Next, use a while loop to repeatedly print a list of possible operations and prompt the user to select one of these operations to apply to their image, then apply the selected operation (create a distinct function for each operation), and display the resulting image. Thus, the user might choose to reflect the image, then increase the contrast (of the now reflected image), and then blur (the now reflected and contrasted image). At each step, the user should be able to see the resulting image. For now, since you haven’t actually implemented the functions for the operations yet, you should implement all of the above except actually applying the filters.

The menu should keep prompting the user to select a filter until they select the Quit option. At the end of this part of the lab, interacting with your program should look something like this:

Welcome to Imagegram!  

Please enter a filename: crayons.jpg

Which of the following filters would you like to apply?

1. Make Negative
2. Make Grayscale
3. Flip Vertically
4. Scroll Horizontally
5. Zoom
6. Blur
0. Quit

Choice: 1

Which of the following filters would you like to apply?
1. Make Negative
2. Make Grayscale
3. Flip Vertically
4. Scroll Horizontally
5. Zoom
6. Blur
0. Quit

Choice: 0

Goodbye!