Initial commit
This commit is contained in:
34
geometry/drawing.py
Normal file
34
geometry/drawing.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from turtle import *
|
||||
from superturtle.movement import fly
|
||||
|
||||
def centered_circle(radius):
|
||||
"""Draws a circle, centered on the turtle's current position.
|
||||
The built-in circle function annoyingly draws a circle whose center
|
||||
is one radius left of the turtle.
|
||||
"""
|
||||
right(90)
|
||||
penup()
|
||||
forward(radius)
|
||||
pendown()
|
||||
left(90)
|
||||
circle(radius)
|
||||
left(90)
|
||||
penup()
|
||||
forward(radius)
|
||||
pendown()
|
||||
right(90)
|
||||
|
||||
def write_label(point, label, align=None, font=None):
|
||||
fly(point.x, point.y)
|
||||
write(label, align=align, font=font)
|
||||
|
||||
def line_end_arrow():
|
||||
"Draws an arrow"
|
||||
left(20)
|
||||
back(20)
|
||||
forward(20)
|
||||
right(40)
|
||||
back(20)
|
||||
forward(20)
|
||||
left(20)
|
||||
|
||||
Reference in New Issue
Block a user