用python turtle畫畫草地天空星星花朵小草

畫畫真的是需要些許藝術細胞(這個我好像沒有,所以將就將就吧。。)


直接上結果,代碼在下方:
在這裏插入圖片描述

import turtle as t

r_a = 0.8
wight = 1400   # 寬
height = 980   # 高

t.hideturtle()
t.colormode(255)
t.color((255, 155, 192), "pink")
t.setup(wight, height)

#繪畫速度
t.tracer(10)


def move_pen(x, y):  # 位置
    t.pu()
    t.goto(x - wight / 2 + 50, y - height / 2 + 50)
    t.pd()


def pen_set(size, r1, g1, b1, r2=0, g2=0, b2=0):  # 畫筆粗細、描邊顏色、填充顏色
    t.pensize(size)
    t.color((r1, g1, b1), (r2, g2, b2))


def draw_bg():  # 畫草地、畫天空
    # 畫草地

    move_pen(-50, 310)
    pen_set(1, 255, 248, 170, 255, 248, 170)
    t.begin_fill()
    t.seth(-90)
    t.fd(350)
    t.seth(0)
    t.fd(1400)
    t.seth(90)
    t.fd(350)
    t.end_fill()
    # 畫天空
    move_pen(-50, 310)
    pen_set(1, 47, 192, 239,4
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章