Is there a way can set the background color for python turtle?

phhnk picture phhnk · Apr 28, 2011 · Viewed 76.1k times · Source

I am trying to set the background color of my turtle graphic, is there a way can set the background color for python turtle?

Answer

Drew picture Drew · Apr 28, 2011

Use turtle.bgcolor(*args).

For instance:

import turtle  
turtle.bgcolor("black")

or

from turtle import *
bgcolor("black")

Read the documentation at http://docs.python.org/library/turtle.html#turtle.bgcolor