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画星空源代码相关推荐

  1. python画星空的程序_用python画星空源代码是什么?

    用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...

  2. python绘制星空_用python画星空源代码是什么?

    用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...

  3. python星空代码_用python画星空源代码是什么?

    用python画星空源代码是什么? 用python画星空源代码是from turtle import * from random import random,randint screen = Scre ...

  4. 用python画星空-用python画星空源代码是什么?

    7mr少儿编程网-Scratch_Python_教程_免费儿童编程学习平台 用python画星空源代码是什么?7mr少儿编程网-Scratch_Python_教程_免费儿童编程学习平台 用python ...

  5. 用python画星空的代码_用python画星空源代码是什么?_后端开发

    用python画星空源代码是什么? 用python画星空源代码是 from turtle import * from random import random,randint screen = Scr ...

  6. python源代码制作星空_用python画星空源代码是什么?

    用python画星空源代码是什么? 用python画星空源代码是 from turtle import *from random import random,randintscreen = Scree ...

  7. 用python画星空-【Python】手把手教你绘制星空旅游线路图

    0 前言 5月是美国的毕业季,我家领导也即将毕业了,我们将在美国进行为期两周的毕业旅行.其实类似这样的航线图我以前也用PPT绘制过,给领导用于发朋友圈,虽然总体能表达出意思,但是效果不能让自己满意,见 ...

  8. 用python画星空的代码简单-【Python】手把手教你绘制星空旅游线路图

    0 前言 5月是美国的毕业季,我家领导也即将毕业了,我们将在美国进行为期两周的毕业旅行.其实类似这样的航线图我以前也用PPT绘制过,给领导用于发朋友圈,虽然总体能表达出意思,但是效果不能让自己满意,见 ...

  9. 用python画星空的代码

    无所不能的python没想到还能画星空,现在就让我们来画一个 from turtle import * from random import random,randint screen = Scree ...

最新文章

  1. 深度学习中的注意力机制(三)
  2. Android消息机制Handler用法
  3. Linux学习笔记-基本操作2
  4. System Analysic utility tools
  5. CSS3--幽灵按钮特效(实例)
  6. 数据仓库--基本概念
  7. recycleview 清空数据 滚动顶部_爱剪辑:制作数字滚动效果,翻滚吧字幕!
  8. imx6q 开发板_mplayer移植-迅为IMX6Q开发板
  9. gsonformat插件_收藏非常有用的IDEA插件,没用过这些IDEA插件?怪不得写代码头疼
  10. 【组图】地震前线归来--心中的震撼
  11. 微信群运营之设计运营思路
  12. Windows 磁盘分区方法
  13. ADOQUERY,CLIENTDATASET,ADOSTOREPROC执行存储过程【多种方法】
  14. ubuntu安装eclipse教程
  15. gamemaker学习笔记:截屏
  16. 三点确定圆心和半径(模版)
  17. 网站安全公司生存发展趋势分析
  18. matlab excel操作,Matlab读取excel文件里数据的操作流程
  19. 论文阅读:Channel Augmented Joint Learning for Visible-Infrared Recognition
  20. 微信拍一拍怎么设置?详细教程,图文分享

热门文章

  1. 你有用过Type-C接口的手电筒吗?
  2. fir.im Weekly - Mobile developer 利器分享
  3. 机器学习中的矩阵向量求导(五) 矩阵对矩阵的求导
  4. 【C语言】简易版_飞机小游戏
  5. 微信小程序web-view 外部引用h5页面调用摄像头录制视频 配有提示音
  6. pacemaker corosync 概念
  7. 非正式组织,比你预想的要重要的多
  8. IntelliJ IDEA在Mac下格式化代码快捷键与失效原因
  9. win10投影无法正常使用:我们正在确认此功能 解决方法
  10. echarts柱状图 饼图 折线图