Pythonは右側の絵のドラゴンが虹を描き手を左

  聞いた左手右手塗装竜塗りの虹は火で、Pythonはまた、正確に虹ロリポップのように美しい虹を描くことができます:)

  示すように、結果:

 

 

 

# -*- coding: utf-8 -*- 
# @Time : 2019/12/16 23:28 
# @Author : Nola
# @File : pen_something.py

import turtle

t = turtle.Pen()
turtle.bgcolor("black")

sides = 6  # 绘制6个边
colors = ["red", "yellow", "green", "blue", "orange", "purple"]

for x in range(360):
    t.pencolor(colors[x % sides])
    t.forward(x * 3 / sides + x)
    t.left(360 / sides + 1)
    t.width(x * sides / 180)
    t.left(91)

おすすめ

転載: www.cnblogs.com/NolaLi/p/12052152.html