# lines_corners.py # Draws pretty lines on screen from turtle import * def draw_lines(N = 40): # Set conditions lines = range(0, N) dx = 320 / N dy = 220 / N x = -160 y = 110 # Set turtle condition hideturtle() speed(0) # 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: # Line 1 color(128 + y, 128 - y, 128 - y) penup() goto(-160, y) pendown() goto(x + dx, -110) # Line 2 color(128 - y, 128 + y, 128 - y) penup() goto(159, y) pendown() goto(-x + 1 - dx, -110) # Line 3 color(128 - y, 128 - y, 128 + y) penup() goto(159, - y + 1) pendown() goto(-x + 1 - dx, 111) # Line 4 color(128 - y, 128 + y, 128 + y) penup() goto(-160, - y + 1) pendown() goto(x + dx, 111) x += dx y -= dy