使用python的turtle繪畫滑稽臉實(shí)例
這是借鑒了一位兄弟的代碼,然后進(jìn)行修改的,原來代碼存在問題,用了2小時,自己修改,終于畫出了滑稽臉,也算是對于今天學(xué)的turtle繪畫庫的一個小小的記錄吧?。ㄓ绣e誤希望各位看官指正?。?/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í)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
python 申請內(nèi)存空間,用于創(chuàng)建多維數(shù)組的實(shí)例
今天小編就為大家分享一篇python 申請內(nèi)存空間,用于創(chuàng)建多維數(shù)組的實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-12-12
Python使用?TCP協(xié)議實(shí)現(xiàn)智能聊天機(jī)器人功能
TCP協(xié)議適用于對效率要求相對較低而準(zhǔn)確性要求很高的場合,下面通過本文給大家介紹基于Python?使用?TCP?實(shí)現(xiàn)智能聊天機(jī)器人,需要的朋友可以參考下2022-05-05
Python獲取中國節(jié)假日數(shù)據(jù)記錄入JSON文件
項目系統(tǒng)內(nèi)置的日歷應(yīng)用為了提升用戶體驗,特別設(shè)置了在調(diào)休日期顯示“休”的UI圖標(biāo)功能,那么問題是這些調(diào)休數(shù)據(jù)從哪里來呢?我嘗試一種更為智能的方法:Python獲取中國節(jié)假日數(shù)據(jù)記錄入JSON文件2025-04-04
詳解Python 實(shí)現(xiàn) ZeroMQ 的三種基本工作模式
ZMQ是一個簡單好用的傳輸層,像框架一樣的一個 socket library,他使得 Socket 編程更加簡單、簡潔和性能更高。 ,這篇文章主要介紹了Python 實(shí)現(xiàn) ZeroMQ 的三種基本工作模式,需要的朋友可以參考下2020-03-03
Pycharm Terminal 與Project interpreter 安裝
本文主要介紹了Pycharm Terminal 與Project interpreter 安裝包不同步問題解決,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-02-02

