문제

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

도움이 되었습니까?

해결책

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

다른 팁

It sounds like you set the color for your turtle, not your screen. A screen will appear even if you don't set up your screen, but then it's not defined so you can't customize it. If you set up the beginning of your code, then you can customize your screen, for example:

import turtle
wn=turtle.Screen()
wn.bgcolor("black")
wn.title("This is my screen title!")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top