I'm drawing the Syrian flag with Python turtle. I left out the two green stars for now, as they require an external dependency (oh wow, how's that for an accidental political pun? lol). Here's the code:
from turtle import *
# Set up the drawing environment
length = 600
height = 400
setup(length, height)
setworldcoordinates(0,0,length,height)
goto(0,0)
colours = ["red","black","white","Darkgreen"]
bgcolor(colours[0])
speed('fastest')
## Black Stripe ##
pencolor(colours[1])
pendown()
fillcolor(colours[1])
begin_fill()
goto(length,0)
goto(length,height/3)
goto(0,height/3)
goto(0,0)
end_fill()
penup()
# White Stripe
goto(0,height/3)
pencolor(colours[2])
pendown()
fillcolor(colours[2])
begin_fill()
goto(length,height/3)
goto(length,(height/3)*2)
goto(0,(height/3)*2)
goto(0,height/3)
end_fill()
penup()
ht()
done()
Why is there a red border around the image? I have set the canvas size and the coordinate system to equal each other so that 1 pixel equals 1 pixel. The black box, for example, should start at the bottom-left edge of the canvas as I have told it to, but in it's stead lies a red border. If you resize the window manually after running the code, no matter how small you make it in an attempt to overlap the red border, there will always be a red border. I haven't even written a border into the code.
I think it might have something to do with the innards of Python turtle, that it just allows a small border in order to see what lies on the coordinates (0,0), but I can't find any documentation that actually shows how turtle works, they all just say things like "setup(x,y) = set canvas size" or bgcolor("enter colour here") and don't explain any of the definitions that make up the functions.
Does anyone know how to either:
- Remove the border?
- Make window size equal to canvas size, hence covering the red border?
Cheers!
(edit: By the way, screensize(length,height) gives me red borders and scrollbars.)
