Related Articles

Related Articles

turtle.filling() function in Python
  • Last Updated : 28 Jul, 2020

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.filling()

This function is used to return fillstate (True if filling, False else). It doesn’t require any argument.

Syntax :

turtle.filling()

Below is the implementation of the above method with some examples :

Example 1: Default value



Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import package
import turtle
  
# check the default 
# filling state
print(turtle.filling())

chevron_right


Output :

False

Example 2: Inside fill

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import package
import turtle
  
# begin the fill and check
# the filling state
turtle.begin_fill()
print(turtle.filling())

chevron_right


Output :

True

Example 3: After fill

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import package
import turtle
  
# begin fill, do something and
# end fill then check filling state
turtle.begin_fill()
turtle.end_fill()
print(turtle.filling())

chevron_right


Output :

False

Here we get that we can check the filling state anywhere in the program and get True only inside the fill statements ie; either after the begin_fill() method or in between the begin_fill() and end_fill() methods.

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :