I am doing an assignment for university, so I can't exactly post the code. So I will have to explain the best I can.

I have to draw 3 stars in a row, 5 points, 6 points, 7 points.

We have to do it using a for loop and the goto(....) function.

I have managed to draw one star, but if i try to draw another star it will draw it ontop of the previous star.

I have a starting point specified as one of the corners of the star using the coordinates of the star found from the angle,
is there a way to change the start point, ie, change where it starts from (0,0)

## All 2 Replies

Here is a hint on the turtle goto(x, y) ...

``````''' turtle_star_six.py
draw a star with six points using Python module turtle
'''

import turtle as tu

def draw_star(x, y, side):
star_angle = 360.0/6
left_angle = star_angle * 2
tu.penup()
# start drawing here (default is center x=0, y=0)
tu.goto(x, y)
tu.pendown()
for k in range(6):
tu.forward(side)
tu.right(star_angle)
tu.forward(side)
tu.left(left_angle)

x = -150
y = -50
side = 100
draw_star(x, y, side)

tu.done()
``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.