本文整理汇总了Python中nodebox.graphics.Path.stroke方法的典型用法代码示例。如果您正苦于以下问题:Python Path.stroke方法的具体用法?Python Path.stroke怎么用?Python Path.stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodebox.graphics.Path
的用法示例。
在下文中一共展示了Path.stroke方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect
# 需要导入模块: from nodebox.graphics import Path [as 别名]
# 或者: from nodebox.graphics.Path import stroke [as 别名]
def connect(points, closed=True):
"""Connects all points in a path."""
if points is None: return None
if len(points) < 2: return None
points = list(points)
start = points[0]
p = Path()
p.moveto(start.x, start.y)
for point in points[1:]:
p.lineto(point.x, point.y)
if closed:
p.close()
p.stroke = Color.BLACK
p.strokeWidth = 1.0
return p
示例2: quad_curve
# 需要导入模块: from nodebox.graphics import Path [as 别名]
# 或者: from nodebox.graphics.Path import stroke [as 别名]
def quad_curve(pt1, pt2, t, distance):
t /= 100.0
cx = pt1.x + t * (pt2.x - pt1.x)
cy = pt1.y + t * (pt2.y - pt1.y)
a = angle(pt1.x, pt1.y, pt2.x, pt2.y) + 90
qx, qy = coordinates(cx, cy, distance, a)
p = Path()
p.moveto(pt1.x, pt1.y)
c1x = pt1.x + 2/3.0 * (qx - pt1.x)
c1y = pt1.y + 2/3.0 * (qy - pt1.y)
c2x = pt2.x + 2/3.0 * (qx - pt2.x)
c2y = pt2.y + 2/3.0 * (qy - pt2.y)
p.curveto(c1x, c1y, c2x, c2y, pt2.x, pt2.y)
p.fill = None
p.stroke = Color.BLACK
p.strokeWidth = 1.0
return p