当前位置: 首页>>代码示例>>Python>>正文


Python Circle.update方法代码示例

本文整理汇总了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()
开发者ID:btownshend,项目名称:crs,代码行数:33,代码来源:mygroup.py

示例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])
开发者ID:btownshend,项目名称:crs,代码行数:50,代码来源:mycell.py


注:本文中的circle.Circle.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。