generated from mwc/lab_turtle
I made a red octagon with the word STOP inside to mimic a stop sign.
I felt determined to learn some other codes that were not mentioned in the article. I imported the code 'write' and 'set position' in order to add the word STOP and to make it go inside of the octagon. Although I was able to figure out the codes, I became determined to make the word STOP as center as possible in the octagon, which took many trials and errors to get it as close as I could.
This commit is contained in:
parent
1ee977b290
commit
2fb9473b08
23
drawing.py
23
drawing.py
|
@ -6,17 +6,30 @@ from turtle import (
|
||||||
penup,
|
penup,
|
||||||
pendown,
|
pendown,
|
||||||
color,
|
color,
|
||||||
|
write,
|
||||||
|
setposition
|
||||||
)
|
)
|
||||||
|
|
||||||
|
color('red')
|
||||||
|
right(45)
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(45)
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(45)
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(45)
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(45)
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(45)
|
||||||
|
forward(100)
|
||||||
|
right(45)
|
||||||
|
forward(100)
|
||||||
|
right(45)
|
||||||
|
forward(100)
|
||||||
|
penup()
|
||||||
|
setposition(-145,-160)
|
||||||
|
style = ('Times New Roman', 75, 'bold')
|
||||||
|
write('STOP', font=style)
|
||||||
|
|
||||||
input()
|
input()
|
||||||
|
|
Loading…
Reference in New Issue