Question
For this project, you will create a shape drawing program using Turtle graphics. Your program will begin by asking the user how many points they
For this project, you will create a shape drawing program using Turtle graphics. Your program will begin by asking the user how many points they would like to enter (# of vertices for the shape). Next, you will use a loop to input each X and Y coordinate and store these coordinates in lists. After inputting all of the coordinates, create a second loop that will draw and fill the shape using the coordinates that were entered. All of this will be inside a loop that will ask the user if they want to draw another shape. If the user enters yes, clear the screen and repeat the process. If the user enters no, the program will exit. The minimum requirements are listed below:
For all of your input for this program, you should use either the turtle.numinput or turtle.textinput function. You can find more information on these functions here: https://docs.python.org/3.1/library/turtle.html#turtle.numinput (Links to an external site.)Links to an external site.
Create InputDimensions function (x and y coordinate lists are the function parameters) - This function will ask the user how many coordinates they want to enter (validate the input) and then use a loop to input each of the X and Y coordinates. Store each of the X and Y coordinates in your lists. You can use the turtle.numinput() function to input each of these values. Make sure your prompt includes the loop index (coordinate #) so the user knows which coordinate they are currently inputting -- something like "Input the X value for coordinate #1".
Create DrawShape function (x and y coordinates are the function parameters) - This function will use the begin_fill and end_fill functions along with a loop to go to each of the coordinates in the X and Y coordinate lists.
Your main function will contain the loop that asks the user if they want to draw another shape. For extra credit, you can include additional options like inputting the fill color, pen size, background color, etc. from the user. You can use the turtle.textinput function to input this information.
Step by Step Solution
3.45 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Here is the completed code for this problem Comments are included go through it learn how things wor...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started