You should see the following code in your programming
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)
rame.start()

Answers

Answer 1

Answer:

import simplegui

import random

def draw_handler(canvas):

for x in range(1000):

colorList = ["Yellow", "Red", "Purple", "White", "Green", "Blue", "Pink", "Orange"]

c = random.choice(colorList)

x = random.randint(1,600)

y = random.randint(1,600)

canvas.draw_point([x, y], c)

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

frame.set_canvas_background("Black")

frame.set_draw_handler(draw_handler)

frame.start()

Explanation:

I used a for loop, setting my range to 1000 which is how you create exactly 1000 points. Next, I defined my color array, my x randint value, and my y randint value. I set both the x and y randint values to 1 - 600 since the frame is 600x600. The rest is pretty self explanatory.


Related Questions

Other Questions
You place a 16 foot ladder against a building. The angle that the ladder forms withthe ground is 60 degrees. How far from the base of the building is the bottom ofthe ladder? round to the nearest foot. 14. Mrs. Buchanan is planning marching routines for the school band. The band has 36 members. Band members can march in any number of rows as long as each row has the same number of members. The marching path, however, limits members to 6 per row. A reference point is an object or location from which the movement of another object is determined. Which of the following could bea reference point?I. a houseII. a moving carIII. a point on a mapIV. a personA. I,III and IV onlyB. I, II, III, and IVC. Ill onlyD. I and III only ABC ~ XYZ Find the length of BC (need an answer as soon as possible, with showing work please) Olivia has a shoe box in the shape of a rectangular prism. She decorates 4 faces of the box,leaving the top and the bottom without decorations. The unshaded parts of the model andthe diagram below show the parts that she decorates. What is the total area that Oliviadecorates?5 in.11 in.8 in190 square inches440 square inches366 square inches256 square inches A factory makes tissue boxes. When the net is folded to make the tissue box, the length is 25 cm, the width is 5 cm, and the height is 20 cm. How much cardboard material is used to make each tissue box? A motorcycle moving 18.8 m/s has57800 J of KE. What is its mass? Write and simplify a linear expression to find the perimeter of a triangle with the side lengths of (2x+7)cm, (2x+7)cm and (3x help me plz One day your parents will die then you will then your children will then your grand children and so on thats how it feels to be dead do you want to be with your family or not Help omggg jdeekeekekekekeieieieieieoi. Dont wanna be mad at What is stress?It's the positive and negative emotions you haveabout yourselfIt's positive thoughts you have towards your friendsand familyoIt's how your environment controls youOIt's how you react to your environment Classify the following triangle. Check all that apply.O A. EquilateralO B. RightD C. AcuteOD. ObtuseO E. IsoscelesDF. Scalene How many solutions will this equation have?x^(2)-12x +13 = 0 What do you already know about plate tectonics? What do you wish to learn about plate tectonics Would stronger American policies in the 1930s have forced Germany, Italy, and Japan to adhere to the principles of international law Please help! Will Mark if you are right!!What is the turning point of the graph of f(x)=|x4|? A certain population increases at a rate proportional to the square root of the population. If the population goes from 2500 to 3600 in five years, what is the population at the end of t years If 250J of energy from the Sun hits theatmosphere at a certain place, but only 128Jmakes it to the surface of the Earth, how muchenergy is reflected by the atmosphere? Lilly is new to her company. Give Lilly some advice about effective communication in an e-mail. Include a subject line. 16 divided by (x + 4) in WORD FORM