本文整理汇总了Python中canoepaddle.Pen.last_path方法的典型用法代码示例。如果您正苦于以下问题:Python Pen.last_path方法的具体用法?Python Pen.last_path怎么用?Python Pen.last_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canoepaddle.Pen
的用法示例。
在下文中一共展示了Pen.last_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_translate_override_bounds
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import last_path [as 别名]
def test_translate_override_bounds():
# Translate a paper that has overridden bounds. The bounds update as well.
paper = Paper()
paper.override_bounds(0, 0, 1, 1)
paper.translate((3, 4))
assert_equal(
paper.bounds(),
Bounds(3, 4, 4, 5)
)
# When bounds=False is passed, then the bounds do not update.
paper = Paper()
paper.override_bounds(0, 0, 1, 1)
paper.translate((3, 4), bounds=False)
assert_equal(paper.bounds(), Bounds(0, 0, 1, 1))
# This also works if the bounds are not overridden.
p = Pen()
p.fill_mode()
p.move_to((0.5, 0.5))
p.circle(0.5)
assert_equal(p.paper.bounds(), Bounds(0, 0, 1, 1))
p.paper.translate((3, 4), bounds=False)
assert_equal(p.paper.bounds(), Bounds(0, 0, 1, 1))
assert_equal(p.last_path().bounds(), Bounds(3, 4, 4, 5))
示例2: test_join_paths_turn_back_no_joint
# 需要导入模块: from canoepaddle import Pen [as 别名]
# 或者: from canoepaddle.Pen import last_path [as 别名]
def test_join_paths_turn_back_no_joint():
p = Pen()
p.stroke_mode(1.0)
p.move_to((0, 0))
p.turn_to(0)
p.line_forward(10)
p.turn_right(180)
p.break_stroke()
p.line_forward(5)
p.paper.join_paths()
line1, line2 = p.last_path().segments
assert line1.end_joint_illegal
assert line2.start_joint_illegal
assert_path_data(
p, 1,
(
'M0.0,-0.5 L0.0,0.5 L10.0,0.5 L10.0,-0.5 '
'L5.0,-0.5 L5.0,0.5 L10.0,0.5 L10.0,-0.5 L0.0,-0.5 z'
)
)