233k views
18 votes
6.6 Code Practice 2- Boat:

Use the code above to write a program that draws an image of a boat on water. Your program should create an image similar to the one below. Your image does not need to be exactly the same as the one above, but can have slight modifications (for example, your image can use a different color or different positioning of
objects).
(In edhesive please)

6.6 Code Practice 2- Boat: Use the code above to write a program that draws an image-example-1

1 Answer

5 votes

Answer:

import simplegui

def draw_handler(canvas):

canvas.draw_circle((0,550), 2, 100, "Blue")

canvas.draw_circle((100,550),2,100,"Blue")

canvas.draw_circle((200,550),2,100,"Blue")

canvas.draw_circle((300,550),2,100,"Blue")

canvas.draw_circle((400,550),2,100,"Blue")

canvas.draw_circle((500,550),2,100,"Blue")

canvas.draw_circle((600,550),2,100,"Blue")

canvas.draw_polygon([(0,550), (600,550), (600,500), (0,500)], 5, "White", "White")

canvas.draw_circle((300, 525), 2, 100, "Black")

canvas.draw_polygon([(250, 525), (350,525), (350, 475), (250, 475)], 5, "White", "White")

canvas.draw_line((250,525), (350,525), 5, "Black")

canvas.draw_line((300,525), (300, 500), 5, "Black")

canvas.draw_polygon([(300,500), (325, 500), (300,450)], 5, "Black")

frame = simplegui.create_frame('Testing', 600, 600)

frame.set_canvas_background("White")

frame.set_draw_handler(draw_handler)

frame.start()

Step-by-step explanation:

Little jank but looks fine

User Matthis Kohli
by
5.2k points