• 大小: 0.52KB
    文件类型: .py
    金币: 1
    下载: 0 次
    发布日期: 2021-03-02
  • 语言: Python
  • 标签:

资源简介

import turtle
from tkinter import *
from tkinter.simpledialog import *
turtle.bgcolor("black")

# You can choose between 2 and 6 sides for some cool shapes!
a = askinteger(title="输入边数:",prompt="请输入边数,范围2-6:",initialvalue="",minvalue=2,maxvalue=6)
sides=a
colors=["red","yellow", "blue", "orange","green","purple"]

for x in range(200):

    turtle.color(colors[x%sides])

    turtle.forward(x*3/sides   x)

    turtle.left(360/sides   1)

    turtle.width(x*sides/200)
turtle.done()

资源截图

代码片段和文件信息

import turtle
from tkinter import *
from tkinter.simpledialog import *
turtle.bgcolor(“black“)

# You can choose between 2 and 6 sides for some cool shapes!
a = askinteger(title=“输入边数:“prompt=“请输入边数,范围2-6:“initialvalue=““minvalue=2maxvalue=6

评论

共有 条评论