溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

使用python的turtle繪畫(huà)滑稽臉實(shí)例

發(fā)布時(shí)間:2020-09-13 03:46:34 來(lái)源:腳本之家 閱讀:253 作者:氵小景 欄目:開(kāi)發(fā)技術(shù)

這是借鑒了一位兄弟的代碼,然后進(jìn)行修改的,原來(lái)代碼存在問(wèn)題,用了2小時(shí),自己修改,終于畫(huà)出了滑稽臉,也算是對(duì)于今天學(xué)的turtle繪畫(huà)庫(kù)的一個(gè)小小的記錄吧?。ㄓ绣e(cuò)誤希望各位看官指正?。?/p>

編譯器是:Atom

python 是3.7版本

運(yùn)行位 Windows power shell

import turtle
turtle.setup(600,600,200,200)

#fcae
turtle.penup()
turtle.goto(-210,0)
turtle.seth(-90)
turtle.pendown()
turtle.pencolor(‘orange')
turtle.pensize(4)
turtle.begin_fill()
turtle.circle(210,360)
turtle.fillcolor(‘yellow')
turtle.end_fill()
turtle.pencolor(‘black')

#mouth
turtle.pensize(5)
turtle.penup()
turtle.goto(-150,30)
turtle.pendown()
turtle.seth(-90)
turtle.circle(150,180)

#left eye
turtle.penup()
turtle.pensize(4)
turtle.goto(-180,90)
turtle.pendown()
turtle.seth(40)
turtle.begin_fill()
turtle.circle(-120,80)
turtle.penup()
turtle.goto(-180,90)
turtle.pendown()
turtle.seth(-130)
turtle.circle(15,110)
turtle.seth(40)
turtle.circle(-106,83)
turtle.seth(30)
turtle.circle(18,105)
turtle.fillcolor(‘white')
turtle.end_fill()

#right eye
turtle.penup()
turtle.goto(20,90)
turtle.pendown()
turtle.seth(40)
turtle.begin_fill()
turtle.circle(-120,80)
turtle.penup()
turtle.goto(20,90)
turtle.pendown()
turtle.seth(-130)
turtle.circle(15,110)
turtle.seth(40)
turtle.circle(-106,83)
turtle.seth(30)
turtle.circle(18,105)
turtle.fillcolor(‘white')
turtle.end_fill()

#Eyeball
turtle.pensize(2)
turtle.penup()
turtle.goto(50,95)
turtle.pendown()
turtle.begin_fill()
turtle.circle(8,360)
turtle.fillcolor(‘black')
turtle.end_fill()
turtle.penup()
turtle.goto(-150,95)
turtle.pendown()
turtle.begin_fill()
turtle.circle(8,360)
turtle.fillcolor(‘black')
turtle.end_fill()

#Blush
turtle.pensize(1)
turtle.pencolor(‘pink')
turtle.begin_fill()
turtle.penup()
turtle.goto(-160,50)
turtle.pendown()
turtle.seth(-90)
for i in range(2):
for j in range(10):
turtle.forward(j)
turtle.left(9)
for j in range(10,0,-1):
turtle.forward(j)
turtle.left(9)
turtle.fillcolor(‘pink')
turtle.end_fill()
turtle.pensize(1)
turtle.pencolor(‘pink')
turtle.begin_fill()
turtle.penup()
turtle.goto(40,50)
turtle.pendown()
turtle.seth(-90)
for i in range(2):
for j in range(10):
turtle.forward(j)
turtle.left(9)
for j in range(10,0,-1):
turtle.forward(j)
turtle.left(9)
turtle.fillcolor(‘pink')
turtle.end_fill()
turtle.hideturtle()

turtle.done()

使用python的turtle繪畫(huà)滑稽臉實(shí)例

以上這篇使用python的turtle繪畫(huà)滑稽臉實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持億速云。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI