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


Python Canvas.require_update方法代码示例

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


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

示例1: test_get_item_at_point

# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import require_update [as 别名]
    def test_get_item_at_point(self):
        """
        Hover tool only reacts on motion-notify events
        """
        canvas = Canvas()
        view = GtkView(canvas)
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.add(view)
        window.show_all()

        box = Box()
        canvas.add(box)
        # No gtk main loop, so updates occur instantly
        assert not canvas.require_update()
        box.width = 50
        box.height = 50

        # Process pending (expose) events, which cause the canvas to be drawn.
        while gtk.events_pending():
            gtk.main_iteration()

        assert len(view._qtree._ids) == 1
        assert not view._qtree._bucket.bounds == (0, 0, 0, 0), view._qtree._bucket.bounds

        assert view.get_item_at_point((10, 10)) is box
        assert view.get_item_at_point((60, 10)) is None

        window.destroy()
开发者ID:pcakapratibha,项目名称:gaphas,代码行数:30,代码来源:test_view.py

示例2: test_item_removal

# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import require_update [as 别名]
    def test_item_removal(self):
        canvas = Canvas()
        view = GtkView(canvas)
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.add(view)
        window.show_all()

        box = Box()
        canvas.add(box)
        # No gtk main loop, so updates occur instantly
        assert not canvas.require_update()

        # Process pending (expose) events, which cause the canvas to be drawn.
        while gtk.events_pending():
            gtk.main_iteration()

        assert len(canvas.get_all_items()) == len(view._qtree)

        view.focused_item = box
        canvas.remove(box)

        assert len(canvas.get_all_items()) == 0
        assert len(view._qtree) == 0

        window.destroy()
开发者ID:pcakapratibha,项目名称:gaphas,代码行数:27,代码来源:test_view.py


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