赞
踩
本文给大家分享的是如何通过 Python 脚本一次运行成功圣诞树代码,圣诞节快到了,兄弟们可以get起来了,拿去哄哄女朋友了!
Python版本:3.11.0
pycharm(专业版需要激活)
turle模块
- import turtle as t
- from turtle import *
- import random as r
- import time
-
- n = 100.0
-
- speed("fastest")
- screensize(bg='black')
- left(90)
- forward(3 * n)
- color("orange", "yellow")
- begin_fill()
- left(126)
-
- for i in range(5): # 画五角星
- forward(n / 5)
- right(144) # 五角星的角度
- forward(n / 5)
- left(72) # 继续换角度
- end_fill()
- right(126)
-
-
- def drawlight(): # 定义画彩灯的方法
- if r.randint(0, 30) == 0: # 如果觉得彩

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。