您好,登錄后才能下訂單哦!
這篇文章主要介紹了python如何畫小汽車,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
畫汽車
試著畫一輛小汽車,給自己樹立一個小目標(biāo)。
(這段代碼新增了color,begin_fill,end_fill,circle,setheading函數(shù))
>>> import turtle >>> t = turtle.Pen() >>> t.color(1,0,0) >>> t.begin_fill() >>> t.forward(100) >>> t.left(90) >>> t.forward(20) >>> t.left(90) >>> t.forward(20) >>> t.right(90) >>> t.forward(20) >>> t.left(90) >>> t.forward(60) >>> t.left(90) >>> t.forward(20) >>> t.right(90) >>> t.forward(20) >>> t.left(90) >>> t.forward(20) >>> t.end_fill() 車身
>>> t.color(0,0,0) >>> t.up() >>> t.forward(10) >>> t.down() >>> t.begin_fill() >>> t.circle(10) >>> t.end_fill() 左車輪
>>> t.setheading(0) >>> t.up() >>> t.forward(90) >>> t.right(90) >>> t.forward(10) >>> t.setheading(0) >>> t.begin_fill() >>> t.down() >>> t.circle(10) >>> t.end_fill() 右車輪
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“python如何畫小汽車”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。