generated from mwc/project_drawing
Compare commits
4 Commits
d90f4c90c9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07fa32f8a5 | ||
|
|
efc30142a6 | ||
|
|
cd13f96603 | ||
|
|
1a09cc4b18 |
BIN
__pycache__/trigram.cpython-312.pyc
Normal file
BIN
__pycache__/trigram.cpython-312.pyc
Normal file
Binary file not shown.
28
drawing old.py
Normal file
28
drawing old.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# drawing.py
|
||||||
|
# ----------
|
||||||
|
# By Seoyeon___________
|
||||||
|
#
|
||||||
|
# (second trial_use fuction_center of Korean flag with two colors)
|
||||||
|
|
||||||
|
from turtle import *
|
||||||
|
def tadpole (radius,colour): # "I name half of yinyang shape tadpole"
|
||||||
|
color("black", colour) # British spellings for colour to distinguish this from color"
|
||||||
|
begin_fill()
|
||||||
|
circle(radius,180) # half circle
|
||||||
|
circle(-radius,180) # another half circle
|
||||||
|
circle(-radius*2,180)
|
||||||
|
end_fill()
|
||||||
|
|
||||||
|
right(15)
|
||||||
|
left(90)
|
||||||
|
tadpole (40, "red")
|
||||||
|
right(90)
|
||||||
|
penup()
|
||||||
|
forward(160)
|
||||||
|
pendown()
|
||||||
|
left(90)
|
||||||
|
tadpole (40, "blue")
|
||||||
|
|
||||||
|
input()
|
||||||
|
|
||||||
|
|
||||||
65
drawing.py
65
drawing.py
@@ -2,31 +2,62 @@
|
|||||||
# ----------
|
# ----------
|
||||||
# By Seoyeon___________
|
# By Seoyeon___________
|
||||||
#
|
#
|
||||||
# (basic practice prior to yin-yang shape.)
|
# (Final Version_adding trigram, adding color code)
|
||||||
|
|
||||||
from turtle import *
|
from turtle import *
|
||||||
color("black", "red")
|
from trigram import draw_trigram
|
||||||
|
def tadpole (width,colour): # "I name half of yinyang shape tadpole"
|
||||||
|
color("black", colour) # British spellings for colour to distinguish this from color"
|
||||||
begin_fill()
|
begin_fill()
|
||||||
forward(40)
|
circle(1/2 * width,180) # half circle
|
||||||
right(90)
|
circle(-1/2 * width,180) # another half circle
|
||||||
forward(20)
|
circle(-1 * width,180)
|
||||||
right(90)
|
|
||||||
forward(40)
|
|
||||||
right(90)
|
|
||||||
forward(20)
|
|
||||||
end_fill()
|
end_fill()
|
||||||
|
|
||||||
|
width=100
|
||||||
penup()
|
penup()
|
||||||
backward(20)
|
forward(1/2 * width)
|
||||||
right(180)
|
right(90)
|
||||||
color("black","blue")
|
forward(1*width)
|
||||||
begin_fill()
|
|
||||||
forward(20)
|
|
||||||
left(90)
|
left(90)
|
||||||
forward(40)
|
|
||||||
left(90)
|
left(90)
|
||||||
forward(20)
|
circle(-2 * width, 33.69)
|
||||||
end_fill()
|
pendown()
|
||||||
|
|
||||||
|
tadpole (width, "#CD2E3A")
|
||||||
|
right(90)
|
||||||
|
penup()
|
||||||
|
forward(2* width)
|
||||||
|
pendown()
|
||||||
|
left(90)
|
||||||
|
tadpole (width, "#0047A0")
|
||||||
|
|
||||||
|
left(90)
|
||||||
|
penup()
|
||||||
|
forward(1/2 * width)
|
||||||
|
pendown()
|
||||||
|
|
||||||
|
draw_trigram ([True, True, True], width)
|
||||||
|
|
||||||
|
|
||||||
|
right(180)
|
||||||
|
penup()
|
||||||
|
forward( (6+12+12+6) / 12 * width)
|
||||||
|
draw_trigram ([False, False, False], width)
|
||||||
|
|
||||||
|
left(90)
|
||||||
|
penup()
|
||||||
|
circle(18 /12 * width, 33.69*2)
|
||||||
|
right(90)
|
||||||
|
draw_trigram ([False, True, False], width)
|
||||||
|
|
||||||
|
right(180)
|
||||||
|
penup()
|
||||||
|
forward( (6+12+12+6) / 12 * width)
|
||||||
|
draw_trigram ([True, False, True], width)
|
||||||
input()
|
input()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
28
drawing_old.py
Normal file
28
drawing_old.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# drawing.py
|
||||||
|
# ----------
|
||||||
|
# By Seoyeon___________
|
||||||
|
#
|
||||||
|
# (second trial_use fuction_center of Korean flag with two colors)
|
||||||
|
|
||||||
|
from turtle import *
|
||||||
|
def tadpole (radius,colour): # "I name half of yinyang shape tadpole"
|
||||||
|
color("black", colour) # British spellings for colour to distinguish this from color"
|
||||||
|
begin_fill()
|
||||||
|
circle(radius,180) # half circle
|
||||||
|
circle(-radius,180) # another half circle
|
||||||
|
circle(-radius*2,180)
|
||||||
|
end_fill()
|
||||||
|
|
||||||
|
right(15)
|
||||||
|
left(90)
|
||||||
|
tadpole (40, "red")
|
||||||
|
right(90)
|
||||||
|
penup()
|
||||||
|
forward(160)
|
||||||
|
pendown()
|
||||||
|
left(90)
|
||||||
|
tadpole (40, "blue")
|
||||||
|
|
||||||
|
input()
|
||||||
|
|
||||||
|
|
||||||
12
test_trigram.py
Normal file
12
test_trigram.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from turtle import left
|
||||||
|
from trigram import (
|
||||||
|
draw_trigram,
|
||||||
|
건,
|
||||||
|
곤,
|
||||||
|
리,
|
||||||
|
감,
|
||||||
|
)
|
||||||
|
|
||||||
|
left(90)
|
||||||
|
draw_trigram([True,False,False], 200)
|
||||||
|
input()
|
||||||
56
trigram.py
Normal file
56
trigram.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
from turtle import *
|
||||||
|
|
||||||
|
건 = [True, True, True]
|
||||||
|
곤 = [False, False, False]
|
||||||
|
리 = [True, False, True]
|
||||||
|
감 = [False, True, False]
|
||||||
|
|
||||||
|
def draw_trigram(pattern, width):
|
||||||
|
"""Draws a trigram from the Korean flag.
|
||||||
|
The starting and ending point is the center of the bottom of
|
||||||
|
the trigram, with the turtle facing up.
|
||||||
|
The pattern should be a list of True/False values, indicating
|
||||||
|
whether each bar should be solid, starting from the top.
|
||||||
|
"""
|
||||||
|
unit = width/12
|
||||||
|
for bar_type in pattern:
|
||||||
|
draw_trigram_bar(bar_type, width)
|
||||||
|
fly(unit * 3)
|
||||||
|
fly(unit*-9)
|
||||||
|
|
||||||
|
def draw_trigram_bar(is_solid, width):
|
||||||
|
"""Draws a single bar from a trigram, starting and ending at the center
|
||||||
|
of the bottom of the bar.
|
||||||
|
"""
|
||||||
|
unit = width/12
|
||||||
|
right(90)
|
||||||
|
fly(unit*-6)
|
||||||
|
if is_solid:
|
||||||
|
draw_black_rectangle(unit*12, unit*2)
|
||||||
|
fly(width/2)
|
||||||
|
else:
|
||||||
|
draw_black_rectangle(unit*5.5, unit*2)
|
||||||
|
fly(unit*6.5)
|
||||||
|
draw_black_rectangle(unit*5.5, unit*2)
|
||||||
|
fly(unit*-0.5)
|
||||||
|
left(90)
|
||||||
|
|
||||||
|
def draw_black_rectangle(width, height):
|
||||||
|
"""Draws a filled black rectangle, starting and ending at the bottom
|
||||||
|
left corner and turning to the left.
|
||||||
|
"""
|
||||||
|
color('black')
|
||||||
|
fillcolor('black')
|
||||||
|
begin_fill()
|
||||||
|
for half in range(2):
|
||||||
|
forward(width)
|
||||||
|
left(90)
|
||||||
|
forward(height)
|
||||||
|
left(90)
|
||||||
|
end_fill()
|
||||||
|
|
||||||
|
def fly(steps):
|
||||||
|
"Move without drawing"
|
||||||
|
penup()
|
||||||
|
forward(steps)
|
||||||
|
pendown()
|
||||||
Reference in New Issue
Block a user