Code to draw Python Turtle Star
# importing turtle import turtle # Set up the screen window = turtle.Screen() # Create a turtle object star = turtle.Turtle() star.shape("turtle") # setting color, size and position of pen star.pencolor("Red") star.pensize(10) star.goto(-100, 0) # create a star pattern for i in range(5): star.forward(220) star.right(144) # to stop output screen turtle.done()
Output:
Important Python turtle Commands
Below are some simple turtle commands that are important and used to create graphics using the turtle module in Python:
- forward(): With help of forward command we can move the turtle in a straight direction by a certain number of units.
- backward(): This command is the same as a forward command in this case it will move the turtle backward by a certain number of units.
- right(): To move turtle in right direction right() command is used. This command turns the turtle right by a certain number of degrees. You can specify the number of degrees as an argument
- left(): To take a left turn we will use the left() command. This command turns the turtle left by a certain number of degrees.
- penup(): This command lifts the turtle’s pen off the digital canvas, so it doesn’t draw anything on the screen. This command is used to pick up the pen and then move to the new location to draw other things, if you move the turtle in the penup state it won’t draw anything. This is useful for shifting the turtle.
- pendown(): By default, turtle operates with pendown state, but if you use the penup() command, it will stop drawing. To resume drawing, you will need to use the pendown() command to return to the previous drawing state.
- pencolor(): To make the drawing more visually appealing we use pencolor() commands to change the color of the link of the turtle drawing.
- shape(): When you will run the program then there will be a shape representing your drawing cursor, which is managed by shape().
- pensize(): To manage the thickness of the pen
- goto(): To take the turtle to a specific position, coordinates-> (x, y)
Thank you for visiting our website.
Also Read:
- Radha Krishna using Python Turtle
- Drawing letter A using Python Turtle
- Wishing Happy New Year 2023 in Python Turtle
- Snake and Ladder Game in Python
- Draw Goku in Python Turtle
- Draw Mickey Mouse in Python Turtle
- Happy Diwali in Python Turtle
- Draw Halloween in Python Turtle
- Write Happy Halloween in Python Turtle
- Draw Happy Diwali in Python Turtle
- Extract Audio from Video using Python
- Drawing Application in Python Tkinter
- Draw Flag of USA using Python Turtle
- Draw Iron Man Face with Python Turtle: Tony Stark Face
- Draw TikTok Logo with Python Turtle
- Draw Instagram Logo using Python Turtle
- I Love You Text in ASCII Art
- Python Turtle Shapes- Square, Rectangle, Circle
- Python Turtle Commands and All Methods
- Happy Birthday Python Program In Turtle
- I Love You Program In Python Turtle
- Draw Python Logo in Python Turtle
- Space Invaders game using Python
- Draw Google Drive Logo Using Python
- Draw Instagram Reel Logo Using Python
- Draw The Spotify Logo in Python Turtle
- Draw The CRED Logo Using Python Turtle
- Draw Javascript Logo using Python Turtle
- Draw Dell Logo using Python Turtle
- Draw Spider web using Python Turtle