python龟图_python学习turtle(龟图标状态)
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
記錄學(xué)習(xí)
turtle.hideturtle()
turtle.ht(),隱藏龜圖標(biāo)。
turtle.showturtle()
turtle.st(),顯示龜圖標(biāo)。
turtle.isvisible(),龜是否顯示。顯示返回true,否則返回false。
turtle.shape(name=None),返回或設(shè)置形狀,最初有以下形狀:“arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”。
turtle.resizemode(rmode=None),返回或設(shè)置龜形狀狀態(tài)。
“auto”:調(diào)整對(duì)應(yīng)于pensize值的烏龜?shù)耐庥^。跟隨pensize變化大小。
“user”:根據(jù)stretchfactor和outlinewidth(outline)的值來(lái)調(diào)整烏龜?shù)耐庥^。shapesize()與參數(shù)一起使用時(shí)調(diào)用resizemode(“user”)
“noresize”:沒(méi)有改變?yōu)觚數(shù)耐庥^。
turtle.shapesize(stretch_wid=None,?stretch_len=None,?outline=None)
turtle.turtlesize(stretch_wid=None,?stretch_len=None,?outline=None),返回或者設(shè)置形狀拉伸大小和輪廓線。
stretch_wid是垂直方向拉伸,stretch_len水平方向拉伸,outline輪廓的寬度。
初始形狀
運(yùn)行,turtle.shapesize(5, 1, 1)
再運(yùn)行turtle.shapesize(5, 1, 5)
turtle.shearfactor(shear=None),設(shè)置或者返回剪力。
turtle.tilt(angle),改變龜角度(按當(dāng)前角度改變),但不改變移動(dòng)方向。
turtle.settiltangle(angle),無(wú)論當(dāng)前是什么角度,重新設(shè)置一個(gè)指向角度。不改變移動(dòng)方向。自3.1版開(kāi)始不推薦使用。
turtle.tiltangle(angle=None),返回當(dāng)前傾斜角度,或重新設(shè)置一個(gè)指向角度。不改變移動(dòng)方向。
turtle.shapetransform(t11=None,?t12=None,?t21=None,?t22=None),設(shè)置或者返回龜形狀矩陣數(shù)據(jù)。
turtle.get_shapepoly(),返回當(dāng)前形狀多邊形作為坐標(biāo)對(duì)的元組。可用于定義復(fù)合形狀的新形狀。
畫(huà)個(gè)太極圖;
import turtle as t
t.home()
t.bgcolor('#ccc')
##大半圓黑色
t.color('#000')
t.fillcolor('#000')
t.begin_fill()
t.circle(100,180)
t.end_fill()
##大半圓白色
t.color('#fff')
t.fillcolor('#fff')
t.begin_fill()
t.circle(100,180)
t.end_fill()
t.up()
t.sety(100)
##中半圓白色
t.color('#fff')
t.fillcolor('#fff')
t.begin_fill()
t.circle(50,180)
t.end_fill()
t.up()
t.goto(0,0)
##中半圓黑色
t.color('#000')
t.fillcolor('#000')
t.begin_fill()
t.circle(-50,180)
t.end_fill()
##兩個(gè)小圓
t.up()
t.sety(34)
t.color('#fff')
t.fillcolor('#fff')
t.begin_fill()
t.circle(16,360)
t.end_fill()
t.up()
t.sety(134)
t.color('#000')
t.fillcolor('#000')
t.begin_fill()
t.circle(16,360)
t.end_fill()
t.ht()
如圖:
總結(jié)
以上是生活随笔為你收集整理的python龟图_python学习turtle(龟图标状态)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: c语言程序怎样缩进整体,C语言程序设计基
- 下一篇: python如何获取表单数据_Pytho