For this assignment, we were instructed to read a book and program the examples with slight adjustments. Then we would take what we learned and apply it to our own art piece. I worked with Nicholas, a classmate, and we created the Discord (A chatroom application) logo. I created most of the commands and the general shapes, while Nicholas did the details and extra commands for the details. If you would look at the logo without the details, it would be hard to identify--but the details make a solid image out of it. Sadly, the logo looks a little off due to problems with fill. I disliked this project due to the frustration from turtle graphics. You may check the code here.
###########################################
# Start
# Created by Nicholas and Gabriel
###########################################
# Importing and Essential Variables
###########################################
#Importing Turtle.
import turtle
# Importing Time (for finish time)
import time
# Normal Turtle.
t = turtle.Turtle()
# Mirror Turtle for easier programming.
i = turtle.Turtle()
i.shape("turtle")
# Speed for turtle.
turtle.speed(1000000)
# Colors for project.
back = '#4F4FEC'
main = '#FFFFFF'
# Creating a fixed screen.
turtle.setworldcoordinates(-300,-300,300,300)
#Setting backdrop color.
turtle.bgcolor(main)
###########################################
# Functions for drawing.
###########################################
# Forward Movement (On T Side) for mirror.
def mMovement(forA):
t.forward(float(forA))
i.backward(float(forA))
# Rotating Movement (both) for mirror.
def mRotate(forB):
t.left(forB)
i.right(forB)
# Get Positioning . (Both)
def mGetPos():
items = {
'T1' : t.pos(),
'T2' : i.pos()
}
return items
# Get Heading. (Both)
def mGetHead():
items = {
'T1' : t.heading(),
'T2' : i.heading()
}
return items
# Set Heading (both)
def mSetHead(deg):
t.setheading(deg)
i.setheading(-1 * deg)
# Pen Up/Down. (Both)
def mPen(updown):
if updown == "up" :
t.penup()
i.penup()
else :
t.pendown()
i.pendown()
# Set Coordinates for mirror (Both)
def mSetCoord(Xcord, Ycord):
t.setpos(Xcord, Ycord)
i.setpos(Xcord, Ycord)
# Pen Coloring. (Both)
def mColor(color):
t.color(str(color))
i.color(str(color))
# Draw Command for top
def drawBody() :
#DRAWING BOTH ARCHES, TOP/BOTTOM OF BODY
mSetCoord(0,-100)
mColor(main)
mPen("down")
for j in range(71) :
mMovement(2)
mRotate(0.2)
endPointsBottom = mGetPos()
mPen('up')
mSetCoord(0,150)
mPen('down')
mRotate(-14.2)
for j in range(71) :
mMovement(2)
mRotate(-0.2)
endPointsTop = mGetPos()
mPen('up')
#DRAWING HANDLES ON THE BOTTOM
t.goto(endPointsBottom['T1'][0],endPointsBottom['T1'][1])
i.goto(endPointsBottom['T2'][0],endPointsBottom['T2'][1])
mSetHead(90)
mPen('down')
t.right(240)
i.left(240)
for n in range(50):
mMovement(2)
mRotate(-.2)
mSetHead(-60)
mMovement(25)
mSetHead(0)
for n in range(71):
mMovement(2)
if (n > 45):
mRotate(1)
else:
mRotate(0.5)
mRotate(-.5)
#DRAWING SIDES
mSetHead(95)
for n in range(130):
mMovement(2)
if (n > 60):
mRotate(0.02)
else:
mRotate(0.08)
#DRAWING TOP, SMALLER HANDLES
mSetHead(155)
for n in range(50):
mMovement(2)
mRotate(0.4)
mSetHead(250)
mMovement(10)
mSetHead(-19.4)
for n in range(49):
mMovement(2)
mRotate(-.2)
#DRAWING EYES
mPen('up')
t.goto(-50,0)
t.dot(75,"white")
t.goto(50,0)
t.dot(75,"white")
# Draw Command for background and bottom.
def drawBack() :
t.begin_fill()
i.begin_fill()
t.dot(895, back)
mPen("up")
###########################################
# Main Code for Drawing.
###########################################
# Drawing.
drawBack()
drawBody()
t.ht()
i.ht()