Last active
October 11, 2021 20:10
-
-
Save im-noob/ce185683e1546ab21962d90b33949ac6 to your computer and use it in GitHub Desktop.
turtle Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import * | |
from time import sleep | |
import random | |
bgcolor('black') | |
speed(0) | |
line_width = 2 | |
colormode(255) | |
while True: | |
r = random.randint(0, 255) | |
g = random.randint(0, 255) | |
b = random.randint(0, 255) | |
pencolor(r,g,b) | |
forward(100) | |
right(90) | |
forward(line_width) | |
right(90) | |
forward(100) | |
left(90) | |
forward(line_width) | |
left(90) | |
# -------------------------------------------------------------------------- | |
from turtle import * | |
from time import sleep | |
import random | |
bgcolor('black') | |
speed(10000) | |
line_width = 2 | |
colormode(255) | |
def forward_draw(dots,color_arr): | |
for i in range(dots//5): | |
forward(5) | |
color(color_arr[i]) | |
while True: | |
r = random.randint(0, 255) | |
g = random.randint(0, 255) | |
b = random.randint(0, 255) | |
pencolor(r,g,b) | |
forward_draw(100,['red','black','blue','cyan','green']*4) | |
right(90) | |
forward(line_width) | |
right(90) | |
forward_draw(100,['red','black','blue','cyan','green']*4) | |
left(90) | |
forward(line_width) | |
left(90) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment