dimanche 26 avril 2015

Drawing random circles within a python turtle circle

I'm trying to randomly place a number of small circles within a larger circle using turtle.

The size of the larger circle depends on wether "small", "medium" or "large" are called, and I need the small circles to stay within the bounds of the radius of each circle.

    def drawCircle(myTurtle, radius):
        circumference = 2 * 3.1415 * radius
        sideLength = circumference / 360
        drawPolygon(myTurtle,sideLength,360)

How do I use random to place circles with smaller radiuses within the initial circle?




Aucun commentaire:

Enregistrer un commentaire