18 Sep turtle.down() or turtle.pendown() function in Python
The turtle.down() or turtle.pendown() function puts the pen down. When the pen is down, the turtle draws a line as it moves.
Syntax: turtle.pendown() or turtle.down()
Parameters: None.
Let us see an example to implement the turtle.pendown() function in Python:
Demo19.py
# turtle.pendown() function in Python # Code by Studyopedia import turtle window = turtle.Screen() t = turtle.Turtle() t.penup() t.forward(50) # Moves without drawing t.pendown() # Put the pen down t.forward(50) # Draws a line window.exitonclick()
The following is the output:

In the above code, we followed the below steps:
- Import the module: import turtle loads Python’s turtle graphics library.
- Create the screen: window = turtle.Screen() opens the drawing window.
- Create the turtle: t = turtle.Turtle() creates the turtle (your pen).
- Lift the pen: t.penup() raises the pen so movements won’t draw.
- Move without drawing: t.forward(50) advances 50 units with no line.
- Lower the pen: t.pendown() puts the pen back down to resume drawing.
- Draw a line: t.forward(50) moves 50 units and draws a line.
- Close on click: window.exitonclick() keeps the window open until you click, then closes.
If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
- OpenCV Tutorial
- Python Tutorial
- NumPy Tutorial
- Pandas Tutorial
- Matplotlib Tutorial
- Generative AI Tutorial
- LangChain Tutorial
- RAG Tutorial
- Machine Learning Tutorial
- Deep Learning Tutorial
- Ollama Tutorial
- Retrieval Augmented Generation (RAG) Tutorial
- Copilot Tutorial
- Gemini Tutorial
- ChatGPT Tutorial
No Comments