Question

Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...

Use Python 3

Create a program that uses Turtle to draw shapes. Show the following menu:

  • Enter Circle
  • Enter Rectangle
  • Remove Shape
  • Draw Shapes
  • Exit

Circles – User inputs position, radius, and color. The position is the CENTER of the circle

Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner

Colors – Allow red, yellow, blue, and green only

Remove – Show the number of items in the list and let the user enter a number and remove that shape from the list. You may assume that they only enter a number within the range that you display.

Draw Shapes – Draw the shapes in the order they are in the list. Clear the screen if shapes had been drawn before. The color is the fill color of the shape. Shapes are only drawn after this selection, not after entering or removing a shape.

Guidelines

  • Create a class called Circle in its own file called circle.py
  • Create a class called Rectangle in its own file called rectangle.py
  • In each class create a method called draw() that will draw the shape (as well as any other methods you need)
  • Store all Circle and Rectangle objects in a single list
  • Use a loop to draw all of the shapes
  • Create a file called assn14-task3.py that contains a main() function to run your program
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#draws circle. where x is the radious def circles (x, colors) t=turtle. Turtle ( ) tor j, color in enumerate (colors): x x+10

#turtleGraphics.py

import turtle

#draws squares. where x is the length of the side

def square(x,colors):

  

t=turtle.Turtle();

t.pendown()

for j, color in enumerate(colors):

t.pencolor(colors[j])

x=x+10

for i in range(4):

t.forward(x)

t.right(90)

turtle.done()

#draws rectangles. where x is the length and y=x+20 is the breadth

def rectangle(x,colors):

y=x+20

t=turtle.Turtle();

t.pendown()

for j, color in enumerate(colors):

#for loop till all colors exhaust

t.pencolor(colors[j])

x=x+10

y=y+10

for i in range(2):

t.forward(x)

t.right(90)

t.forward(y)


t.right(90)

turtle.done()

#draws circle. where x is the radious

def circles(x,colors):

t=turtle.Turtle()

for j, color in enumerate(colors):

x=x+10

t.pencolor(colors[j])

t.pendown()

t.circle(x)

turtle.done()   

colors = ['red', 'orange', 'yellow', 'green', 'blue', 'violet']

option=input('Enter 50 to draw circle or 100 to draw square or 150 to rectangle:')

if option==50:

print 'It prints circles serially in all available colors'

circles(option,colors)

elif option==100:

print 'It prints squares serially in all available colors'

square(option,colors)

elif option==150:

print 'It prints rectangles serially in all available colors'

rectangle(option,colors)

Add a comment
Know the answer?
Add Answer to:
Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In python use draw turtle to draw 2 different shapes that look visually appealing and here...

    In python use draw turtle to draw 2 different shapes that look visually appealing and here are the criteria: -Must have have a function and a for loop in that function -and also have a while loop outside the function that calls the function. -and also have the user be able to input how many of the shapes he want such as the example below num_of_rectangles_and_square = int(input('how many rectangles and squares would you like drawn?'))

  • Write a program in Python that will: Here are following requirements to completing Menu shapes: 1....

    Write a program in Python that will: Here are following requirements to completing Menu shapes: 1. Create a "MENU" with 4 - 5 options have the user click the option and thereafter ask the user to enter the amount of stars from 1 - 50. From there your "for loop" will create the shape. Menu options need to be: 1. Filled Triangle 2. filled Square 3. This can be any shape such as a Square, circle, a different angle of...

  • GUI bouncing shapes program use this interface the out put of the program should be a jFr...

    GUI bouncing shapes program use this interface the out put of the program should be a jFrame with three buttons: “add triangle”, “add square” and “add circle” and a blank screen. when the user clicks any of these buttons the corresponding shape appears and starts bouncing around the screen. the shape of these shaoes and randomized and anytime the user clicks the button you should be able to keeping adding shapes on the screen while the previosus shape is bouncing...

  • Using Python Write the following well-documented (commented) program. Create a class called Shape that has a...

    Using Python Write the following well-documented (commented) program. Create a class called Shape that has a method for printing the area and the perimeter. Create three classes (Square, Rectangle, and Circle) which inherit from it. Square will have one instance variable for the length. Rectangle will have two instance variables for the width and height. Circle will have one instance variable for the radius. The three classes will have methods for computing the area and perimeter of its corresponding shape....

  • Create a program that calculates the area of various shapes. Console Specifications Create an abstract class...

    Create a program that calculates the area of various shapes. Console Specifications Create an abstract class named Shape. This class should contain virtual member function named get_area() that returns a double type. Create a class named Circle that inherits the Shape class and contains these constructors and member functions: Circle(double radius) double get_radius() void set_radius(double radius) double get_area() Create a class named Square that inherits the Shape class and contains these constructors and member functions: Square(double width) double get_width() void...

  • Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw...

    Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Each shape type should be drawn by its own method (that you write) with parameters indicating where it is to be drawn and how big it is to be. Consider including the color as a parameter as well; this would make the function more flexible. Draw at least ten...

  • Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shap...

    Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Each shape type should be drawn by its own method (that you write) with parameters indicating where it is to be drawn and how big it is to be. Consider including the color as a parameter as well; this would make the function more flexible. Draw at least ten...

  • Q2) Interface Create a program that calculates the perimeter and the area of any given 2D...

    Q2) Interface Create a program that calculates the perimeter and the area of any given 2D shape. The program should dynamically assign the appropriate calculation for the given shape. The type of shapes are the following: • Quadrilateral 0 Square . Perimeter: 4xL • Area:LXL O Rectangle • Perimeter: 2(L+W) • Area:LxW Circle Circumference: I x Diameter (TT = 3.14) Area: (TT xD')/4 Triangle (assume right triangle) o Perimeter: a+b+c O Area: 0.5 x base x height (hint: the base...

  • I have to create a java graphics program which will draw 10 rectangles and 10 ellipses...

    I have to create a java graphics program which will draw 10 rectangles and 10 ellipses on the screen. These shapes are to be stored in an arrayList. I have to do this using 6 different class files. I am not sure whether I successfully created an ellipse in the Oval Class & also need help completing the print Class. I need someone to check whether my Oval Class is correct (it successfully creates an ellipse with x, y, width,...

  • (In Java) Create an applet which draws two sets of concentric circles. Each set will use recursio...

    (In Java) Create an applet which draws two sets of concentric circles. Each set will use recursion: Start with a diameter of 255 for the outermost circle As each circle is drawn, use a color created via a constructor in the Color class: Color circleColor = new Color(diameter, diameter, diameter) ; Use recursion to draw the next inner circle: for one set of circles, decrease the diameter of each circle by 20 pixels for the other set of circles, decrease...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT