[技术分享]Python 系列教程之生成五星红旗

maoshiba发布于18 天前 • 65 次阅读

Python基础画个五星红旗

# -*- coding: utf-8 -*-
from turtle import *
# 移动点
def move(x, y):
    up()
    goto(x, y)
    down()
# 画大星星
def draw_big(size, x, y):
    move(x, y)
    begin_fill()
    for i in range(5):
        forward(size)
        right(144)
    end_fill()
# 画小星星
def draw_small(size, x, y):
    move(x, y)
    begin_fill()
    for i in range(5):
        forward(size)
        left(144)
    end_fill()
bgcolor("red")
color("yellow")
fillcolor("yellow")
draw_big(100, -280, 170)
draw_small(40, -130, 240)
draw_small(40, -100, 180)
draw_small(40, -100, 120)
draw_small(40, -130, 60)
done()

image

共收到 4 条回复
t

。。。。。

maoshiba

@t070705627 嘤嘤嘤

x
var a = {}
var b = {}
b.a = a
a.b = b
y

👏 👏 👏