Saturday, September 6, 2025
HomeLanguagesturtle.Screen().bgcolor() function in Python

turtle.Screen().bgcolor() function in Python

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.Screen().bgcolor()

This method is used to set or return background color of the Turtle Screen.

Syntax:

turtle.bgcolor(*args)

Parameters:

Format                              Argument                     Description                              
bgcolor(“color”) color string of color name
bgcolor(r, g, b) r, g, b rgb color code values

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

Example 1 :

Python3




# importing package
import turtle
  
# set the background color
# of the turtle screen
turtle.Screen().bgcolor("orange")
  
# move turtle
turtle.forward(100)


Output :

Example 2 :

Python3




# importing package
import turtle
  
# set the background color
# of the turtle screen
turtle.Screen().bgcolor(0,0,255)
  
# move turtle
turtle.forward(100)


Output :

RELATED ARTICLES

Most Popular

Dominic
32270 POSTS0 COMMENTS
Milvus
82 POSTS0 COMMENTS
Nango Kala
6639 POSTS0 COMMENTS
Nicole Veronica
11803 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11869 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7029 POSTS0 COMMENTS
Thapelo Manthata
6705 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS