1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jonny [76]
3 years ago
12

Create a python code with 5 circles, 5 polygons, 5 line commands, 2 for loops, and 1 global variable

Computers and Technology
1 answer:
kenny6666 [7]3 years ago
8 0

Answer:

# Interactive Drawing

# Shapes

# This is an overview of the shapes that can be drawn on the

# canvas. For full details, please look at the documentation.

# If you are having issues figuring out which shape is drawn

# by which line of code, try commenting some of them out.

# General notes: It is acceptable to use either () or [] when

# listing points. However, be careful that you match

# the number and type of () or [] that you are using. Also,

# polygons and circles have optional parameters that allow

# you to select a fill color.

import simplegui

import math

# Global Variables

canvas_width = 600

canvas_height = 600

# Event Handlers

       

def draw(canvas):

   # Line Segment

   

   point_one = (10, 20)

   point_two = (300, 20)

   line_width = 5

   line_color = "Red"

   canvas.draw_line(point_one, point_two, line_width, line_color)

   canvas.draw_line((335, 25), (550, 50), 25, "Blue")

   

   # Connected Line Segments

   

   # Note that any number of points are allowed, and they

   # connect in the order that they are listed in the

   # method parameters. (same goes for polygons)

   point_one = (30, 50)

   point_two = (130, 150)

   point_three = (170, 100)

   line_width = 10

   line_color = "Purple"

   canvas.draw_polyline([point_one, point_two, point_three], line_width, line_color)

   canvas.draw_polyline([(500, 150), (400, 100), (342, 117), (301, 151), (200, 150)], 3, "Orange")

   

   # Polygons - All

   

   point_one = (50, 200)

   point_two = (80, 260)

   point_three = (170, 210)

   point_four = (100, 225)

   point_five = (75, 205)

   line_width = 5

   line_color = "Aqua"

   fill_color = "Lime"

   canvas.draw_polygon([point_one, point_two, point_three, point_four, point_five], line_width, line_color)

   point_one = (250, 200)

   point_two = (280, 260)

   point_three = (370, 210)

   point_four = (300, 225)

   point_five = (275, 205)

   canvas.draw_polygon([point_one, point_two, point_three, point_four, point_five], line_width, line_color, fill_color)

   canvas.draw_polygon([(450, 200), (550, 200), (450, 300), (550, 300)], 10, "Navy", "Olive")

   

   # Polygons - Rectangles

   

   # Same syntax as polygons, just using four points

   canvas.draw_polygon([(50, 300), (50, 350), (150, 350), (150, 300)], 8, "Green")

   # Simple formulas:

   # Top left corner = (a, b), Bottom right = (c, d)

   a = 200

   b = 300

   c = 220

   d = 350

   canvas.draw_polygon([(a, b), (a, d), (c, d), (c, b)], 2, "Yellow", "Yellow")

   # Top left corner = (a, b)

   a = 275

   b = 300

   width = 140 # For squares, width = height

   height = 75

   canvas.draw_polygon([(a, b), (a, b + height), (a + width, b + height), (a + width, b)], 20, "Fuchsia")

   

   # Polygons - Triangles

   

   # Same syntax as polygons, just using three points

   canvas.draw_polygon([(50, 420), (150, 470), (200, 370)], 5, "Teal", "Teal")

   # For right triangles:

   a = 200

   b = 450

   width = 100 # For one type of isosceles triangle, width = height

   height = 100

   canvas.draw_polygon([(a, b), (a + width, b), (a, b + height)], 6, "White")

   # Formula for equilateral triangles:

   a = 450

   b = 450

   width = 100

   canvas.draw_polygon([(a, b), (a + width, b), ((2 * a + width) / 2, b + width / 2 / math.tan(math.pi / 6))], 5, "Black", "Gray")

   

   # Circles

   

   center = (75, 550)

   radius = 30

   line_width = 5

   line_color = "Silver"

   fill_color = "Maroon"

   canvas.draw_circle(center, radius, line_width, line_color)

   center = (150, 550)

   canvas.draw_circle(center, radius, line_width, line_color, fill_color)

   canvas.draw_circle((350, 550), 50, 10, "Red")

   canvas.draw_circle((350, 550), 25, 10, "Blue", "Blue")

   

# Frame

frame = simplegui.create_frame("Shapes", canvas_width, canvas_height)

# Register Event Handlers

frame.set_draw_handler(draw)

# Remember to start the frame

frame.start()

Explanation:

This Should Work :)

You might be interested in
You are creating a budget for your new business. What should you include?
Lina20 [59]

The answer is A.

When creating a business budget, include all you income sources and ad both fixed and variable costs and expenses.

The first and most important element of a good business budget is to tally and figure out your income sources. Income sources include things like product sales, earnings, and others. You should also be able to determine the fixed costs and include variable expenses. Variable expenses are those items that do not have a fixed price tag and may include raw materials, commissions, advertising, transportation, printing services, and many others.

7 0
3 years ago
How do I make my own extension for chrome?
Alexeev081 [22]
Open your browser and click the 3 strip bar in the conner and then look toward the bottom and click settings and it will open a new browser and then you are going to look at the left side and you will see extension click it and there you go...

4 0
3 years ago
What type of computer should you consider purchasing if you want a portable system that is good for students and on-the-go profe
Gemiola [76]

Answer:

laptop

Explanation:

,.....................

6 0
2 years ago
When is blue for when the instance in which the directory of compulsion in the air!
KATRIN_1 [288]
I think it’s what the other person said
7 0
3 years ago
You work part-time at a computer repair store, and you are on-site at a customer's premises. Your customer has signed up for DSL
patriot [66]

The fill up are:

First Install the DSL router and link it to the phone line via:

  • Look at the Shelf, and expand Routers.
  • Take in the DSL router to the Workspace area.
  • Beyond the router, click on Back to switch to the back view of the router.

<h3>What is the steps about?</h3>

Next check On the Shelf, and expand Cables.

Click on the twisted pair cable that has RJ11 connectors.

Looking at the Selected Component window, take in a connector to the RJ11 port on the router.

Looking at the Selected Component window, take in or drad the other connector to the empty phone port that can be seen on the wall outlet.

Then Plug in the router via:

The Shelf, click on the power adapter.

  • Using the Selected Component window, take in the DC power connector to the power port on the DSL router and also take in the AC power plug to the wall outlet then:

Click on the computer to the DSL router as follows:

Beyond the computer, click on Back to switch to the back view of the computer and in the Shelf, click on the Cat5e cable.

Using the Selected Component window, take in a connector to the network port on the computer and then take in other connector to a network port on the DSL router.

The implementing DSL and Select the DSL filter then click on the phone cable under Partial connections and take in or drag unconncected connector to the RJ11 port on the filter.

Learn more about DSL internet  from

brainly.com/question/14599737

#SPJ1

5 0
2 years ago
Other questions:
  • In your own words, describe the advantages and disadvantages of the auto-negotiation protocol used in Ethernet communications.
    6·1 answer
  • _____ computing refers to a computing environment that is always present, can feel our surroundings, and-based on who we are, wh
    8·1 answer
  • Example of hard ware that computers on a network can share are he operating and the web browser? True or false
    7·2 answers
  • What is thhe name of service included with windows server operating systemthat manages a centralized database containing user ac
    5·1 answer
  • Alice is an investor who has created a device controlled by an app that will water plants automatically. Alice has no experience
    9·1 answer
  • Jonathan is eight years old and is a participant in a study assessing the eating habits of schoolchildren. To assess the childre
    5·1 answer
  • How do i clear my search history ?
    9·2 answers
  • Consider the following code segment, where num is an integer variable.
    6·1 answer
  • What is keyword density?
    15·2 answers
  • The firewall protects a computer or network from network-based attacks along with _____________ of data packets traversing the n
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!