本文整理汇总了Python中canoepaddle.pen.Pen.circle方法的典型用法代码示例。如果您正苦于以下问题:Python Pen.circle方法的具体用法?Python Pen.circle怎么用?Python Pen.circle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canoepaddle.pen.Pen
的用法示例。
在下文中一共展示了Pen.circle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_circle_line_overlap
# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import circle [as 别名]
def test_circle_line_overlap():
# Draw a circle that is above one line but below the other line.
p = Pen()
p.stroke_mode(1.0, color=(1.0, 0.0, 0.0))
p.move_to((0, 0))
p.turn_to(0)
p.line_forward(4)
p.fill_mode(color=(0.0, 1.0, 0.0))
p.move_to((2, 2))
p.circle(2)
p.stroke_mode(1.0, color=(0.0, 0.0, 1.0))
p.move_to((0, 4))
p.turn_to(0)
p.line_forward(4)
assert_equal(
p.paper.svg_elements(1),
[
(
'<path d="M0.0,-0.5 L0.0,0.5 L4.0,0.5 L4.0,-0.5 L0.0,-0.5 z" '
'fill="#ff0000" />'
),
(
'<path d="M4.0,-2.0 A 2.0,2.0 0 0 0 0.0,-2.0 '
'A 2.0,2.0 0 0 0 4.0,-2.0 z" fill="#00ff00" />'
),
(
'<path d="M0.0,-4.5 L0.0,-3.5 L4.0,-3.5 L4.0,-4.5 L0.0,-4.5 z" '
'fill="#0000ff" />'
),
]
)
示例2: test_circle_degenerate
# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import circle [as 别名]
def test_circle_degenerate():
p = Pen()
p.stroke_mode(2.0)
p.circle(1)
assert_equal(
p.paper.svg_elements(0),
['<path d="M2,0 A 2,2 0 0 0 -2,0 A 2,2 0 0 0 2,0 z" fill="#000000" />']
)
示例3: test_circle
# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import circle [as 别名]
def test_circle():
p = Pen()
p.fill_mode()
p.circle(1)
assert_equal(
p.paper.svg_elements(0),
['<path d="M1,0 A 1,1 0 0 0 -1,0 A 1,1 0 0 0 1,0 z" fill="#000000" />']
)
示例4: test_circle_color
# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import circle [as 别名]
def test_circle_color():
p = Pen()
p.move_to((0, 0))
p.turn_to(0)
p.fill_mode((1.0, 0.0, 0.0))
p.circle(1)
p.move_forward(2)
p.fill_mode((0.0, 1.0, 0.0))
p.circle(1)
p.move_forward(2)
p.fill_mode((0.0, 0.0, 1.0))
p.circle(1)
assert_equal(
p.paper.svg_elements(0),
[
'<path d="M1,0 A 1,1 0 0 0 -1,0 A 1,1 0 0 0 1,0 z" fill="#ff0000" />',
'<path d="M3,0 A 1,1 0 0 0 1,0 A 1,1 0 0 0 3,0 z" fill="#00ff00" />',
'<path d="M5,0 A 1,1 0 0 0 3,0 A 1,1 0 0 0 5,0 z" fill="#0000ff" />',
]
)