文章目录
前言
今天,我们来用Python做个星空。
一、模拟星空
1,.首先导入所需要的库:
from turtle import *
from random import random, randint
2.初始画面:
screen = Screen()
width, height = 800, 600
screen.setup(width, height)
screen.title('模拟3D星空')
screen.bgcolor('black')
screen.mode('logo')
screen.delay(0) # 这里要设为0,否则很卡
t = Turtle(visible=False, shape='circle')
t.pencolor('white')
t.fillcolor('white')
t.penup()
总代码:
from turtle import *
from random import random, randint
screen = Screen()
width, heig