Created / clarified more comments

This commit is contained in:
Louis Cooper 2023-07-23 19:04:41 -04:00
parent 432d4bf74c
commit d193355daf
1 changed files with 19 additions and 16 deletions

View File

@ -8,14 +8,16 @@ from http.client import RemoteDisconnected
from turtle import * from turtle import *
import random import random
pensize(2) pensize(2) #Sets line width for drawing.
def fly(x, y): #Utlizes x, y positions to move the turtle #Utlizes x, y positions to move the turtle
def fly(x, y):
penup() penup()
goto(x, y) goto(x, y)
pendown() pendown()
def starting_position(): #sets initial position of the drawing. See fly() #sets initial position of the drawing. See fly()
def starting_position():
penup() penup()
fly(-600, -300) fly(-600, -300)
pendown() pendown()
@ -36,6 +38,7 @@ def rectangle(length, height, corner_radius=0):
else: else:
left(90) left(90)
#Draws a black background
def draw_background(): def draw_background():
speed(0) speed(0)
fillcolor("black") fillcolor("black")
@ -53,32 +56,30 @@ def draw_tv():
begin_fill() begin_fill()
rectangle(300, 210, 10) rectangle(300, 210, 10)
end_fill() end_fill()
#Antenna
# Antenna - added
color("#C0C0C0") color("#C0C0C0")
pensize(5) pensize(5)
penup() penup()
goto(-350, 10) # Positioning the antenna goto(-350, 10)
pendown() pendown()
setheading(30) # Angle for the left part of the antenna setheading(30)
forward(100) forward(100)
penup() penup()
goto(-350, 10) # Going back to the antenna's root goto(-350, 10)
pendown() pendown()
setheading(150) # Angle for the right part of the antenna setheading(150)
forward(100) forward(100)
pensize(2) pensize(2)
setheading(0) # Resetting the direction setheading(0)
# Antenna Base - added #Antenna Base
penup() penup()
goto(-360, 0) # Positioning the base goto(-360, 0)
pendown() pendown()
fillcolor('#C0C0C0') fillcolor('#C0C0C0')
begin_fill() begin_fill()
circle(10) circle(10)
end_fill() end_fill()
color("black") color("black")
# Antenna Base ends
#inner screen border #inner screen border
fillcolor('#1a1a1a') fillcolor('#1a1a1a')
@ -158,6 +159,7 @@ def draw_tv():
draw_tv() draw_tv()
#Instructional Text
def instructions_text(): def instructions_text():
fly(-540, -290) fly(-540, -290)
color("white") color("white")
@ -172,7 +174,9 @@ def detect_circle_click(x_pos, y_pos):
nextScreen() nextScreen()
elif x_pos > -266.0 and x_pos < -235 and y_pos < -70.0 and y_pos > -99.0: elif x_pos > -266.0 and x_pos < -235 and y_pos < -70.0 and y_pos > -99.0:
nextScreen() nextScreen()
onscreenclick(detect_circle_click)
#Selects from a random list of colors to change the screen to.
def nextScreen(): def nextScreen():
hideturtle() hideturtle()
screen_colors = ['white', 'black', 'red', 'green', 'blue', 'cyan', 'yellow', 'magenta', screen_colors = ['white', 'black', 'red', 'green', 'blue', 'cyan', 'yellow', 'magenta',
@ -191,6 +195,5 @@ def nextScreen():
rectangle(180, 158, 5) rectangle(180, 158, 5)
end_fill() end_fill()
onscreenclick(detect_circle_click) mainloop()
mainloop() #what does this do?
done() #prevents window from closing done() #prevents window from closing