189k views
13 votes
6.3 Code Practice

You should see the following code in your programming environment:

import simplegui

def draw_handler(canvas):
# your code goes here

frame = simplegui.create_frame('Testing', 600, 600)
frame.set_canvas_background("Black")
frame.set_draw_handler(draw_handler)
frame.start()


Use the code above to write a program that, when run, draws 1000 points at random locations on a frame as it runs. For an added challenge, have the 1000 points be in different, random colors.

User Ducminh
by
4.4k points

1 Answer

3 votes

Answer:

Use the canvas code to draw 1000 points but then for the location import the random module and use random.randrange() for it

Step-by-step explanation:

The drawing object will be used for drawing

The random class is used for the random numbers

I hope it helps

User Levent Kaya
by
5.1k points