безопасное место для установки черепахи? - PullRequest
0 голосов
/ 05 декабря 2018

Однако я пытался использовать этот код в качестве заставки;у меня возникла проблема с отображением 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.

1 Ответ

0 голосов
/ 05 декабря 2018

Я думаю, вы спрашиваете, как сделать линию толще.Это поможет, если вы предоставите исходный код, который вы изменяете, вместе с вашей версией.Я считаю, что это делает то, что вы описываете и исправляет другие проблемы с кодом:

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)

enter image description here

...