Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a loop to draw multiple objects

Status
Not open for further replies.
Jul 4, 2007
1
0
0
GB
I am a newbie to Python and I know this is a stupid question.

How do you draw objects using a loop?

This code doesn't work:

for i in range(4):
circle = Circle(Point(0,20)100
circle.draw(win)

Please help
 
You look to have an unmatched parenthesis in your second line of code, is that correct?

Anyway, assuming your drawing code works, and the syntax is correct, I would say you are drawing the same circle 4 times.

If you want a different circle each time, try to incorporate the variable i in the circle constructor.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top