lines.py

Created by rr-inyo

Created on February 20, 2024

542 Bytes

Draw pretty lines on screen


# lines.py
# Draws pretty lines on screen
from turtle import *

def draw_lines():
  # Set conditions
  N = 20
  lines = range(0, N)
  dx = 320 / N
  dy = 220 / N
  
  # Set turtle condition
  hideturtle()
  speed(10)
  
  # Draw screen frame
  #penup()
  #goto(-160, -110)
  #pendown()
  #goto(159, -110)
  #goto(159, 111)
  #goto(-160, 111)
  #goto(-160, -110)
  
  # Draw lines
  for line in lines:
    color(128 + y, 128 - y, 128 - y)
    penup()
    goto(-160, y)
    pendown()
    goto(x + dx, -110)
    x += dx
    y -= dy

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.