Open In App

turtle.filling() function in Python

Last Updated : 19 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

turtle.filling() function in Python’s turtle module checks if the turtle is currently in a fill state. It returns True when drawing commands are enclosed between turtle.begin_fill() and turtle.end_fill() and False otherwise, making it useful for tracking and controlling shape filling.

Syntax:

turtle.filling()

Parameters: This function does not take any parameters.

Returns:

  • True: if the turtle is in fill mode
  • False: if the turtle is not in fill mode

Examples

Example 1: Default value

Python
import turtle

# Check the default filling state
print(turtle.filling())

Output:

False

Explanation: By default, the turtle is not in a fill state, so it returns False.

Example 2: Inside fill

Python
import turtle

# Begin the fill and check state
turtle.begin_fill()
print(turtle.filling())

Output :

True

Explanation: After calling begin_fill(), the turtle enters fill mode, so it returns True.

Example 3: After Completing a Fill

Python
import turtle

turtle.begin_fill()
turtle.circle(50) 
turtle.end_fill()

print(turtle.filling())

Output :

False

Explanation: Once end_fill() is called, the shape is filled and the turtle exits fill mode, so it returns False.


Article Tags :
Practice Tags :

Similar Reads