Related Articles

Related Articles

turtle.Screen().bgcolor() function in Python
  • Last Updated : 17 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.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

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

Example 2 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :


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 :