本文整理汇总了Python中canoepaddle.Pen.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Pen.copy方法的具体用法?Python Pen.copy怎么用?Python Pen.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canoepaddle.Pen
的用法示例。
在下文中一共展示了Pen.copy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copy_log
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_log():
p1 = Pen()
p1.fill_mode()
p1.move_to((0, 0))
p1.turn_to(0)
p1.line_forward(5)
p2 = p1.copy(paper=True)
p2.line_forward(5)
assert_equal(
p1.log(),
[
'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)',
]
)
assert_path_data(
p1, 0,
'M0,0 L5,0'
)
assert_equal(
p2.log(),
[
'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)',
'line_forward(5)',
]
)
assert_path_data(
p2, 0,
'M0,0 L5,0 L10,0'
)
示例2: test_copy_loop
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_loop():
p = Pen()
p.stroke_mode(0.2)
def square():
p.turn_to(180)
p.line_forward(1)
p.turn_left(90)
p.line_forward(1)
p.turn_left(90)
p.line_forward(1)
p.turn_left(90)
p.line_forward(1)
p.move_to((0, 0))
square()
p = p.copy(paper=True)
p.move_to((2, 0))
square()
assert_path_data(
p, 1,
(
'M0.1,-0.1 L-1.1,-0.1 L-1.1,1.1 L0.1,1.1 L0.1,-0.1 z '
'M-0.1,0.1 L-0.1,0.9 L-0.9,0.9 L-0.9,0.1 L-0.1,0.1 z '
'M2.1,-0.1 L0.9,-0.1 L0.9,1.1 L2.1,1.1 L2.1,-0.1 z '
'M1.9,0.1 L1.9,0.9 L1.1,0.9 L1.1,0.1 L1.9,0.1 z'
)
)
示例3: test_copy_text
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_text():
p = Pen()
p.move_to((0, 0))
p.text('abcd', 1, 'sans-serif')
p = p.copy(paper=True)
svg_data = p.paper.format_svg(0)
assert (
'<text x="0" y="0" font-family="sans-serif" font-size="1" '
'fill="#000000">abcd</text>'
) in svg_data
示例4: test_copy_no_mode
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_no_mode():
p = Pen()
assert_raises(
AttributeError,
lambda: p.mode
)
p = p.copy()
assert_raises(
AttributeError,
lambda: p.mode
)
示例5: test_copy_arc_to
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_arc_to():
p = Pen()
p.fill_mode()
p.move_to((0, 0))
p.turn_to(0)
p.arc_to((5, 5))
p = p.copy(paper=True)
assert_path_data(
p, 0,
'M0,0 A 5,5 0 0 0 5,-5'
)
示例6: test_copy_no_paper
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_no_paper():
p1 = Pen()
p1.fill_mode()
p1.move_to((0, 0))
p1.turn_to(0)
p1.line_forward(5)
p2 = p1.copy()
p2.line_forward(5)
assert_path_data(
p1, 0,
'M0,0 L5,0'
)
assert_path_data(
p2, 0,
'M5,0 L10,0'
)
示例7: test_copy_arc
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import copy [as 别名]
def test_copy_arc():
p1 = Pen()
p1.fill_mode()
p1.move_to((0, 0))
p1.turn_to(0)
p1.arc_left(90, radius=5)
p2 = p1.copy(paper=True)
p2.arc_left(90, radius=5)
assert_path_data(
p1, 0,
'M0,0 A 5,5 0 0 0 5,-5'
)
assert_path_data(
p2, 0,
'M0,0 A 5,5 0 0 0 5,-5 A 5,5 0 0 0 0,-10'
)