使用python的turtle繪畫滑稽臉實(shí)例
這是借鑒了一位兄弟的代碼,然后進(jìn)行修改的,原來(lái)代碼存在問(wèn)題,用了2小時(shí),自己修改,終于畫出了滑稽臉,也算是對(duì)于今天學(xué)的turtle繪畫庫(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繪畫滑稽臉實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python使用tablib生成excel文件的簡(jiǎn)單實(shí)現(xiàn)方法
這篇文章主要介紹了Python使用tablib生成excel文件的方法,結(jié)合實(shí)例形式分析了tablib模塊的相關(guān)使用技巧,需要的朋友可以參考下2016-03-03Python類的詳細(xì)定義與使用案例(實(shí)例講解)
這篇文章主要給大家介紹了關(guān)于Python類的詳細(xì)定義與使用案例的相關(guān)資料,在Python中類表示具有相同屬性和方法的對(duì)象的集合,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-10-10python實(shí)現(xiàn)處理Excel表格超詳細(xì)系列
這篇文章主要介紹了python實(shí)現(xiàn)處理Excel表格超詳細(xì)系列,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-08-08python使用xmlrpclib模塊實(shí)現(xiàn)對(duì)百度google的ping功能
這篇文章主要介紹了python使用xmlrpclib模塊實(shí)現(xiàn)對(duì)百度google的ping功能,實(shí)例分析了xmlrpclib模塊的相關(guān)技巧,需要的朋友可以參考下2015-06-06Python實(shí)現(xiàn)Excel表格轉(zhuǎn)HTML
Excel工作簿是常用的表格格式,廣泛用于組織、分析及展示數(shù)據(jù),這篇文章主要為大家詳細(xì)介紹了如何使用Python將Excel工作簿或工作表轉(zhuǎn)換為HTML文件,需要的可以參考下2024-03-03