您好,登錄后才能下訂單哦!
這是借鑒了一位兄弟的代碼,然后進行修改的,原來代碼存在問題,用了2小時,自己修改,終于畫出了滑稽臉,也算是對于今天學的turtle繪畫庫的一個小小的記錄吧!(有錯誤希望各位看官指正啊)
編譯器是:Atom
python 是3.7版本
運行位 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繪畫滑稽臉實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持億速云。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。