python龟图_python学习turtle(龟图标状态)
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
記錄學習
turtle.hideturtle()
turtle.ht(),隱藏龜圖標。
turtle.showturtle()
turtle.st(),顯示龜圖標。
turtle.isvisible(),龜是否顯示。顯示返回true,否則返回false。
turtle.shape(name=None),返回或設置形狀,最初有以下形狀:“arrow”, “turtle”, “circle”, “square”, “triangle”, “classic”。
turtle.resizemode(rmode=None),返回或設置龜形狀狀態(tài)。
“auto”:調(diào)整對應于pensize值的烏龜?shù)耐庥^。跟隨pensize變化大小。
“user”:根據(jù)stretchfactor和outlinewidth(outline)的值來調(diào)整烏龜?shù)耐庥^。shapesize()與參數(shù)一起使用時調(diào)用resizemode(“user”)
“noresize”:沒有改變?yōu)觚數(shù)耐庥^。
turtle.shapesize(stretch_wid=None,?stretch_len=None,?outline=None)
turtle.turtlesize(stretch_wid=None,?stretch_len=None,?outline=None),返回或者設置形狀拉伸大小和輪廓線。
stretch_wid是垂直方向拉伸,stretch_len水平方向拉伸,outline輪廓的寬度。
初始形狀
運行,turtle.shapesize(5, 1, 1)
再運行turtle.shapesize(5, 1, 5)
turtle.shearfactor(shear=None),設置或者返回剪力。
turtle.tilt(angle),改變龜角度(按當前角度改變),但不改變移動方向。
turtle.settiltangle(angle),無論當前是什么角度,重新設置一個指向角度。不改變移動方向。自3.1版開始不推薦使用。
turtle.tiltangle(angle=None),返回當前傾斜角度,或重新設置一個指向角度。不改變移動方向。
turtle.shapetransform(t11=None,?t12=None,?t21=None,?t22=None),設置或者返回龜形狀矩陣數(shù)據(jù)。
turtle.get_shapepoly(),返回當前形狀多邊形作為坐標對的元組。可用于定義復合形狀的新形狀。
畫個太極圖;
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()
##兩個小圓
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()
如圖:
總結
以上是生活随笔為你收集整理的python龟图_python学习turtle(龟图标状态)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言程序怎样缩进整体,C语言程序设计基
- 下一篇: 兄弟7895dw粉盒清零_兄弟broth