本文整理匯總了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'
)
)