opensourcenija
asked on
looping circles in python
I am trying to loop a circle in python something like the picture attached below
def drawPatch1(win,colour):
for i in range(15):
dia=20
dia1 =dia + 20
circ= Circle(Point(100,200), dia)
circ.setOutline(colour)
circ.draw(win)
circe.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks the solution offered by kusala worked
Also, you have to set dia = 20 before the loop (the line 3 in front of the line 2 and fix the indentation); otherwise, you are setting 20 again and again. You do not need the dia1 variable. Just remove the line 4 and put the line after 7 (with the correct indentation):
dia = dia + 20
Then it should draw 15 concentric circles. After making it working, introduce a new y variable for the center point -- in front of the loop, just after dia initialization. Initialize the y to the coordinates of touching point plus dia/2. Fixt the position of y as the last line of the loop (y = ytouch + dia/2).