Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS CODEHS, PLEASE USE PYTHON, PLEASE AND THANKS IN ADVANCE :D Write a function that draws horizontal lines on the graphics canvas. If a

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

THIS IS CODEHS, PLEASE USE PYTHON, PLEASE AND THANKS IN ADVANCE :D

Write a function that draws horizontal lines on the graphics canvas. If a line is horizontal, then the y-values for the endpoints are the same. The parameters to your function should be the y location and the length. All of your lines should start at x position 0. Your function must be named horizontal_line For example if you call: horizontal_line (100, 200); you should get a horizontal line of length 200 starting at position (0, 100) and going to position (200, 100). To draw a line, you will use the Line function that is similar to how we draw circles and rectangles. Use the examples in Docs tab to help out. If you call the following line: horizontal_line (100, 200) horizontal_line (200, 100) horizontal_line(300, 20) your canvas should look like: Write a program that draws a stoplight. You should have a gray rectangle, and then three circles in the rectangle. The circles should be red, then yellow, then green The rectangle should be centered on the screen. The yellow light should be centered on the screen, and the red and green light should be offset by BUFFER amount. BUFFER amount represents the distance from the center of one circle to the center of another circle. Implement the function draw_circle that draws a single circle. Use it to draw the red, yellow, and green lights. Since all of the lights are the same size and aligned vertically, the function only needs to take the y position and color as arguments. Note: Be sure to include comments for all functions that you use or create. Write a function called draw_pool_ball that draws a pool ball. This function should take the following parameters: the color, the number that should go on the pool ball, and the location of the center of the pool ball. The radius of the pool balls should be POOL_BALL_RADIUS, and the font of the number should be POOL_BALL_FONT.. The text of the pool ball font should be white. You may want to modify the previous exercise's draw_circle function to use here. . You should be able to call your function like this: draw_pool_ball(color.orange, 5, 180, 100) draw_pool_ball(Color.red, 3, 158, 350) draw_pool_ball(Color.blue, 2, 258, 140) draw_pool_ball(Color.green, 6, 50, 200) Note: Be sure to include comments for all functions that you use or create

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

List at least three uses of data mining.

Answered: 1 week ago