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


Python Canvas.update方法代码示例

本文整理汇总了Python中gaphas.canvas.Canvas.update方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.update方法的具体用法?Python Canvas.update怎么用?Python Canvas.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gaphas.canvas.Canvas的用法示例。


在下文中一共展示了Canvas.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_minimal_se

# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import update [as 别名]
    def test_minimal_se(self):
        """
        Test resizing of element by dragging it SE handle.
        """
        canvas = Canvas()
        box = Box()
        handles = box.handles()

        canvas.add(box)

        h_nw, h_ne, h_se, h_sw = handles
        assert h_nw is handles[NW]
        assert h_ne is handles[NE]
        assert h_sw is handles[SW]
        assert h_se is handles[SE]

        h_se.pos.x -= 20      # h.se.{x,y} == -10
        h_se.pos.y -= 20
        assert h_se.pos.x == h_se.pos.y == -10

        box.request_update()
        canvas.update()

        self.assertEquals(10, h_se.pos.x) # h_se changed above, should be 10
        self.assertEquals(10, h_se.pos.y)

        self.assertEquals(10, h_ne.pos.x)
        self.assertEquals(10, h_sw.pos.y)
开发者ID:adrianboguszewski,项目名称:gaphas,代码行数:30,代码来源:test_element.py

示例2: create_canvas

# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import update [as 别名]
def create_canvas():
    canvas = Canvas()
    box = Box()
    canvas.add(box)
    box.matrix.translate(100, 50)
    box.matrix.rotate(50)
    box2 = Box()
    canvas.add(box2, parent=box)


    line = Line()
    line.handles()[0].visible = False
    line.handles()[0].connected_to = box
    line.handles()[0].disconnect = my_disconnect()
    line.handles()[0].connection_data = 1

    canvas.add(line)

    canvas.update()

    return canvas
开发者ID:jvorcak,项目名称:gpylint,代码行数:23,代码来源:test_pickle.py

示例3: test_resize_se

# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import update [as 别名]
    def test_resize_se(self):
        """
        Test resizing of element by dragging it SE handle.
        """
        canvas = Canvas()
        box = Box()
        handles = box.handles()

        canvas.add(box)

        h_nw, h_ne, h_se, h_sw = handles
        assert h_nw is handles[NW]
        assert h_ne is handles[NE]
        assert h_sw is handles[SW]
        assert h_se is handles[SE]

        # to see how many solver was called:
        # GAPHAS_TEST_COUNT=3 nosetests -s --with-prof --profile-restrict=gaphas gaphas/tests/test_element.py | grep -e '\<solve\>' -e dirty

        count = getenv('GAPHAS_TEST_COUNT')
        if count:
            count = int(count)
        else:
            count = 1

        for i in range(count):
            h_se.pos.x += 100      # h.se.{x,y} = 10, now
            h_se.pos.y += 100
            box.request_update()
            canvas.update()

        self.assertEquals(110 * count, h_se.pos.x) # h_se changed above, should remain the same
        self.assertEquals(110 * count, float(h_se.pos.y))

        self.assertEquals(110 * count, float(h_ne.pos.x))
        self.assertEquals(110 * count, float(h_sw.pos.y))
开发者ID:adrianboguszewski,项目名称:gaphas,代码行数:38,代码来源:test_element.py


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