#π Python turlte graphic help
9 messages Β· Page 1 of 1 (latest)
@warm moth
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
my code:
import turtle
import time
screen = turtle.Screen()
screen.bgcolor("skyblue")
screen.setup(800, 600)
screen.tracer(0)
def create_circle_poly(radius):
t = turtle.Turtle()
t.hideturtle()
t.penup()
t.goto(0, -radius)
t.setheading(0)
t.pendown()
t.begin_poly()
t.circle(radius)
t.end_poly()
return t.get_poly()
sun_shape = turtle.Shape("compound")
sun_shape.addcomponent(create_circle_poly(130), "#fa0019", "#fa0019") # Red
sun_shape.addcomponent(create_circle_poly(110), "#FF944C", "#FF944C") # Orange
sun_shape.addcomponent(create_circle_poly(90), "#fcd72b", "#fcd72b") # Yellow
screen.register_shape("sun", sun_shape)
sun = turtle.Turtle()
sun.penup()
sun.shape("sun")
sun.goto(-400, -200)
for _ in range(160):
x, y = sun.pos()
sun.goto(x + 5, y + 2)
screen.update()
time.sleep(0.02)
turtle.done()
remove t.pendown() from your circle poly function
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.