本文整理汇总了Python中circle.Circle.update方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.update方法的具体用法?Python Circle.update怎么用?Python Circle.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类circle.Circle
的用法示例。
在下文中一共展示了Circle.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyGroup
# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import update [as 别名]
class MyGroup(Group):
"""Represents a group on the floor.
Create a group as a subclass of the basic data element.
Stores the following values:
m_color: color of cell
"""
def __init__(self, field, id, gsize=None, duration=None, x=None, y=None,
diam=None, color=None):
if color is None:
self.m_color = DEF_GROUPCOLOR
else:
self.m_color = color
self.m_shape = Circle()
super(MyGroup, self).__init__(field, id, gsize, duration, x, y, diam)
def update(self, gsize=None, duration=None, x=None, y=None,
diam=None, color=None):
"""Store basic info and create a DataElement object"""
if color is not None:
self.m_color = color
super(MyGroup, self).update(gsize, duration, x, y, diam)
def draw(self):
if self.m_x is not None and self.m_y is not None:
self.m_shape.update(self.m_field, (self.m_x, self.m_y),
self.m_diam/2, self.m_color, solid=False)
self.m_shape.draw()
示例2: MyCell
# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import update [as 别名]
class MyCell(Cell):
"""Represents one person/object on the floor.
Create a cell as a subclass of the basic data element.
Stores the following values:
m_color: color of cell
makeBasicShape: create the set of arcs that will define the shape
"""
def __init__(self, field, id, x=None, y=None, vx=None, vy=None, major=None,
minor=None, gid=None, gsize=None, color=None):
if color is None:
self.m_color = DEF_LINECOLOR
else:
self.m_color = color
self.m_body_color = DEF_BODYCOLOR
self.m_shape = Circle()
self.m_bodyshape = Circle()
super(MyCell, self).__init__(field, id, x, y, vx, vy, major, minor,
gid, gsize)
def update(self, x=None, y=None, vx=None, vy=None, major=None,
minor=None, gid=None, gsize=None, color=None, visible=None,
frame=None):
"""Store basic info and create a DataElement object"""
if color is not None:
self.m_color = color
super(MyCell, self).update(x, y, vx, vy, major, minor, gid, gsize,
visible=visible, frame=frame)
def draw(self):
if self.m_x is not None and self.m_y is not None:
self.m_shape.update(self.m_field, (self.m_x, self.m_y),
self.m_diam/2,
color=self.m_color,
solid=False)
self.m_field.m_osc.send_laser(OSCPATH['graph_begin_cell'],[self.m_id])
self.m_shape.draw()
if DRAW_BODIES:
self.m_bodyshape.update(self.m_field, (self.m_x, self.m_y),
self.m_body_diam/2,
color=self.m_body_color,
solid=True)
self.m_bodyshape.draw()
self.m_field.m_osc.send_laser(OSCPATH['graph_end_cell'],[self.m_id])