用法:
turtle.color(*args)返回或設置 pencolor 和 fillcolor。
允許多種輸入格式。他們使用 0 到 3 個參數,如下所示:
color()返回當前 pencolor 和當前 fillcolor 作為一對顏色規範字符串或由
pencolor()和fillcolor()返回的元組。color(colorstring),color((r,g,b)),color(r,g,b)pencolor()中的輸入,將 fillcolor 和 pencolor 都設置為給定值。color(colorstring1, colorstring2),color((r1,g1,b1), (r2,g2,b2))等效於
pencolor(colorstring1)和fillcolor(colorstring2),如果使用其他輸入格式,則類似。
如果 turtleshape 是一個多邊形,該多邊形的輪廓和內部將使用新設置的顏色繪製。
>>> turtle.color("red", "green") >>> turtle.color() ('red', 'green') >>> color("#285078", "#a0c8f0") >>> color() ((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
相關用法
- Python turtle.colormode用法及代碼示例
- Python turtle.colormode()用法及代碼示例
- Python turtle.color()用法及代碼示例
- Python turtle.circle()用法及代碼示例
- Python turtle.clearstamps用法及代碼示例
- Python turtle.clearstamp用法及代碼示例
- Python turtle.clear()用法及代碼示例
- Python turtle.clearstamp()用法及代碼示例
- Python turtle.circle用法及代碼示例
- Python turtle.clone()用法及代碼示例
- Python turtle.clearstamps()用法及代碼示例
- Python turtle.write_docstringdict()用法及代碼示例
- Python turtle.reset用法及代碼示例
- Python turtle.delay()用法及代碼示例
- Python turtle.write()用法及代碼示例
- Python turtle.getpen()用法及代碼示例
- Python turtle.isvisible用法及代碼示例
- Python turtle.onkey用法及代碼示例
- Python turtle.tracer用法及代碼示例
- Python turtle.end_fill()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 turtle.color。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
