人到中年有點(diǎn)甜
2023-09-12 16:53:07
我的代碼:import turtlescreen = turtle.Screen()bob = turtle.Turtle()screen.bgcolor("black")bob.speed(0)def crazy(): for i in range(360): for colors in ['red', 'yellow', 'green', 'purple', 'orange', 'blue']: bob.pencolor(colors) bob.forward(i) bob.left(124)crazy()我想大大加快繪制過(guò)程,以便更快地繪制最終圖像。關(guān)于如何做到這一點(diǎn)有什么想法嗎?順便說(shuō)一句,我正在開(kāi)發(fā)一個(gè)藝術(shù)蒙太奇 python 項(xiàng)目,你可能會(huì)猜到這個(gè)項(xiàng)目會(huì)在其中。感謝所有幫助,謝謝。
1 回答

小怪獸愛(ài)吃肉
TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超1個(gè)贊
考慮使用 turtle.tracer(0, 0)它每次都會(huì)停止刷新,最后做turtle.update()
import turtle
screen = turtle.Screen()
bob = turtle.Turtle()
screen.bgcolor("black")
bob.speed(0)
turtle.tracer(0, 0)
def crazy():
for i in range(360):
for colors in ['red', 'yellow', 'green', 'purple', 'orange', 'blue']:
bob.pencolor(colors)
bob.forward(i)
bob.left(124)
crazy()
turtle.update()
添加回答
舉報(bào)
0/150
提交
取消