19 Sep turtle.filling() function in Python
The turtle.filling() function returns True if a fill operation is in progress (i.e., after begin_fill() and before end_fill()), otherwise returns False.
Syntax: turtle.filling()
Parameters: None.
Let us see an example to implement the turtle.filling() function in Python:
Demo27.py
# turtle.filling() function in Python
# Code by Studyopedia
import turtle
window = turtle.Screen()
t = turtle.Turtle()
print("Currently filling:", t.filling()) # Check if filling
t.begin_fill()
print("Currently filling:", t.filling()) # Check again
t.end_fill()
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).
- Check fill state (initial): print(“Currently filling:”, t.filling()) prints whether a fill is active. Initially this is False.
- Start filling: t.begin_fill() begins recording the path for a filled shape; subsequent moves will define the boundary.
- Check fill state (during): print(“Currently filling:”, t.filling()) now prints True because a fill is in progress.
- End filling: t.end_fill() closes the fill operation and fills the traced region with the current fill color (if you drew a closed shape in between).
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