''' Robot.py by Jasper Hayler-Goodall. Draws a robot! Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .''' from turtle import * # change these values to get scaled robots of a different size w=600 h=650 setup(w,h, 100,0) speed(11) shape('turtle') pencolor("black") fillcolor("#FF0000") penup() right(90) forward(h/5) def halfRobot(a): # start of robot #leg pendown() begin_fill() right(a) forward(w/6) left(a) forward((2*h)/13) left(a) forward(w/12) right(a) forward(h/13) right(a) forward(w/4) right(a) forward(h/13) right(a) forward(w/12) left(a) forward((h*2)/13) left(a) forward(h/13) right(a) forward((h*5)/13) #arm left(a) forward(w/20) left(a) forward((h*17)/65) right(a) forward(w/12) right(a) forward((h*2)/65) right(a) forward(w/30) left(a) forward((h*4)/13) right(a) forward((w)/3) left(a) #head/neck forward((h*2)/65) left(a) forward((w)/6) right(a) forward((h*2)/13) right(a) forward((16*w)/60) penup() end_fill() print(position()) def rect(x,y): # draws a rectangle pendown() begin_fill() forward(x) left(90) forward(y) left(90) forward(x) left(90) forward(y) end_fill() penup() halfRobot(90) right(90) forward((42*h)/65) halfRobot(270) left(90) forward((h*8)/65) right(90) forward((w)/60) fillcolor("yellow") right(180) rect(20,20) right(90) forward((11*w)/60) right(90) forward((2*h)/65) right(90) def I(): # draws an eye fillcolor("black") rect(70,50) left(90) penup() forward(w/60) fillcolor("white") pendown() rect(30,50) I() left(90) forward(w/4) I() exitonclick()