216k views
1 vote
Edhesive 6.8 code practice

2 Answers

4 votes

Answer:

import simplegui

def draw_handler(canvas):

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

frame.set_canvas_background("Black")

frame.set_draw_handler(draw_handler)

frame.start()

Step-by-step explanation:

User Jordan Rieger
by
4.3k points
10 votes

Answer:

import simplegui

x = 50

y = 200

def draw_handler(canvas):

global x

global y

color = "RGB(15, 150, 150)"

RED = "RGB(150,0,0"

BLUE ="RGB(0,20,200"

x = x + 20

if (x >= 1000):

x = 50

canvas.draw_circle((x, y), 50, 1, color, color)

canvas.draw_circle((x, y+20), 50, 1, RED, RED)

canvas.draw_circle((x, y+50), 50, 1, BLUE, BLUE)

canvas.draw_line((x, y), (x+50, y+200), 5, "Red")

canvas.draw_line((x, y), (x+20, y+200), 5, "Green")

canvas.draw_line((x, y), (x-20, y+500), 5, "White")

frame = simplegui.create_frame("Go", 1000, 400)

frame.set_draw_handler(draw_handler)

frame.start()

Step-by-step explanation:

your welcome

User Mika Lammi
by
4.8k points