用python画星空源代码
from turtle import *
from random import random,randint
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()
t.setheading(-90)
t.goto(width/2,randint(-height/2,height/2))
stars = []
for i in range(200): star = t.clone() s =random() /3 star.shapesize(s,s) star.speed(int(s*10)) star.setx(width/2 + randint(1,width)) star.sety( randint(-height/2,height/2)) star.showturtle() stars.append(star)
while True: for star in stars: star.setx(star.xcor() - 3 * star.speed()) if star.xcor()<-width/2: star.hideturtle() star.setx(width/2 + randint(1,width)) star.sety( randint(-height/2,height/2)) star.showturtle()
用python画星空源代码相关推荐
- python画星空的程序_用python画星空源代码是什么?
用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...
- python绘制星空_用python画星空源代码是什么?
用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...
- python星空代码_用python画星空源代码是什么?
用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...
- 用python画星空-用python画星空源代码是什么?
7mr少儿编程网-Scratch_Python_教程_免费儿童编程学习平台 用python画星空源代码是什么?7mr少儿编程网-Scratch_Python_教程_免费儿童编程学习平台 用python ...
- 用python画星空的代码_用python画星空源代码是什么?_后端开发
用python画星空源代码是什么? 用python画星空源代码是 from turtle import * from random import random,randint screen = Scr ...
- python源代码制作星空_用python画星空源代码是什么?
用python画星空源代码是什么? 用python画星空源代码是 from turtle import *from random import random,randintscreen = Scree ...
- 用python画星空-【Python】手把手教你绘制星空旅游线路图
0 前言 5月是美国的毕业季,我家领导也即将毕业了,我们将在美国进行为期两周的毕业旅行.其实类似这样的航线图我以前也用PPT绘制过,给领导用于发朋友圈,虽然总体能表达出意思,但是效果不能让自己满意,见 ...
- 用python画星空的代码简单-【Python】手把手教你绘制星空旅游线路图
0 前言 5月是美国的毕业季,我家领导也即将毕业了,我们将在美国进行为期两周的毕业旅行.其实类似这样的航线图我以前也用PPT绘制过,给领导用于发朋友圈,虽然总体能表达出意思,但是效果不能让自己满意,见 ...
- 用python画星空的代码
无所不能的python没想到还能画星空,现在就让我们来画一个 from turtle import * from random import random,randint screen = Scree ...
最新文章
- 深度学习中的注意力机制(三)
- Android消息机制Handler用法
- Linux学习笔记-基本操作2
- System Analysic utility tools
- CSS3--幽灵按钮特效(实例)
- 数据仓库--基本概念
- recycleview 清空数据 滚动顶部_爱剪辑:制作数字滚动效果,翻滚吧字幕!
- imx6q 开发板_mplayer移植-迅为IMX6Q开发板
- gsonformat插件_收藏非常有用的IDEA插件,没用过这些IDEA插件?怪不得写代码头疼
- 【组图】地震前线归来--心中的震撼
- 微信群运营之设计运营思路
- Windows 磁盘分区方法
- ADOQUERY,CLIENTDATASET,ADOSTOREPROC执行存储过程【多种方法】
- ubuntu安装eclipse教程
- gamemaker学习笔记:截屏
- 三点确定圆心和半径(模版)
- 网站安全公司生存发展趋势分析
- matlab excel操作,Matlab读取excel文件里数据的操作流程
- 论文阅读:Channel Augmented Joint Learning for Visible-Infrared Recognition
- 微信拍一拍怎么设置?详细教程,图文分享