放置乌龟设置的安全地方?
safe place to put turtle settings?
不过,我一直在修改这段代码以充当屏幕保护程序;我一直遇到 1 像素显示的问题;我需要把乌龟笔的尺寸调大,但如果不启动失败,就没有地方放;上面,中间,底部我都试过了,都没有用
from turtle import *
import random
from random import randint # from the random module import the function randint
#like turtle it is a module, read ahead for use
speed(9999999)
bgcolor('black')
x = 1
while x < 40099999999999999:
r = randint(0,255) #makes variables r,g,b whose value is an integer,
g = randint(0,255) # which is between 0 and 255. It is random, and
b = randint(0,255) # changes every time the loop runs
colormode(255) # this is something that is irrelevant at this point - unless you are using python 2.
pencolor(r,g,b) # changes the color of the pen to the rgb coordinates
# obtained by the variables r, g, b changing each time
fd(random.random() + random.randrange(99) * random.random())
rt(90)#V1.1 - removed the random for this module - no reason to have random for the same number - wastes cpu power.
x = x+1
谢谢; amdcrash.
我猜你是在问如何让线条变粗。如果您提供您正在修改的原始代码以及您的版本,将会有所帮助。我相信这可以满足您的描述并修复代码的其他问题:
from turtle import *
from random import random, randrange
speed('fastest')
width(3) # "i need to put the turtle pen size up"
bgcolor('black')
colormode(255)
for x in range(1_000_000):
r = randrange(256) # makes variables r,g,b whose value is an integer,
g = randrange(256) # which is between 0 and 255. It is random, and
b = randrange(256) # changes every time the loop runs
pencolor(r, g, b) # changes the color of the pen to the rgb coordinates
forward(random() + randrange(99) * random())
right(90)
不过,我一直在修改这段代码以充当屏幕保护程序;我一直遇到 1 像素显示的问题;我需要把乌龟笔的尺寸调大,但如果不启动失败,就没有地方放;上面,中间,底部我都试过了,都没有用
from turtle import *
import random
from random import randint # from the random module import the function randint
#like turtle it is a module, read ahead for use
speed(9999999)
bgcolor('black')
x = 1
while x < 40099999999999999:
r = randint(0,255) #makes variables r,g,b whose value is an integer,
g = randint(0,255) # which is between 0 and 255. It is random, and
b = randint(0,255) # changes every time the loop runs
colormode(255) # this is something that is irrelevant at this point - unless you are using python 2.
pencolor(r,g,b) # changes the color of the pen to the rgb coordinates
# obtained by the variables r, g, b changing each time
fd(random.random() + random.randrange(99) * random.random())
rt(90)#V1.1 - removed the random for this module - no reason to have random for the same number - wastes cpu power.
x = x+1
谢谢; amdcrash.
我猜你是在问如何让线条变粗。如果您提供您正在修改的原始代码以及您的版本,将会有所帮助。我相信这可以满足您的描述并修复代码的其他问题:
from turtle import *
from random import random, randrange
speed('fastest')
width(3) # "i need to put the turtle pen size up"
bgcolor('black')
colormode(255)
for x in range(1_000_000):
r = randrange(256) # makes variables r,g,b whose value is an integer,
g = randrange(256) # which is between 0 and 255. It is random, and
b = randrange(256) # changes every time the loop runs
pencolor(r, g, b) # changes the color of the pen to the rgb coordinates
forward(random() + randrange(99) * random())
right(90)