from turtle import *
import time
ht()
setup(width=500, height=500, startx=0, starty=0)
x=0
y=0
goto(0, 0)
colormode(255)
while True:
write("Please type your screens size in pixels into the console.", move=False, align="center", font=("Arial", 10, "normal"))
x = int(input('x'))
y = int(input('y'))
if x > 0:
print('.')
if y > 0:
print('...')
break
if x==0:
x=1000
y=500
break
else:
clear()
write("Please enter a valid number (ie. x, y)", move=False, align="center", font=("Arial", 28, "normal"))
setup(width=1400, height=800, startx=100, starty=20)
clear()
def FADE_IN_OUT(arg, align, font, size, Norm, fspeedin, fspeedout, pause):
r=255
g=255
b=255
for i in range(51):
pencolor((r,g,b))
write(arg, move=False, align=align, font=(font, size, Norm))
r-=5
g-=5
b-=5
time.sleep(fspeedin/51)
time.sleep(pause)
clear()
for i in range(51):
clear()
pencolor((r,g,b))
write(arg, move=False, align=align, font=(font, size, Norm))
r+=5
g+=5
b+=5
time.sleep(fspeedout/51)
FADE_IN_OUT("47 Studios", "center", "Arial", x//5, "normal", 2.5, 2.5, 5)
我想知道如何加快这个程序,花一两分钟来做10秒,我确定这是一个非常简单的问题而且我只是愚蠢但我是新手节奏更快的节目。
答案 0 :(得分:2)
您可以通过设置turtle.speed
0
是最快的。所以,你可以设置turtle.speed(0)
让乌龟以最快的速度画画。
或者,因为您已导入所有内容speed(0)