本文整理汇总了Python中gaphas.canvas.Canvas.update_now方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.update_now方法的具体用法?Python Canvas.update_now怎么用?Python Canvas.update_now使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaphas.canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.update_now方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_line_guide
# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import update_now [as 别名]
def test_line_guide(self):
c = Canvas()
l = Line()
c.add(l)
l.handles().append(l._create_handle((20, 20)))
l.handles().append(l._create_handle((30, 30)))
l.handles().append(l._create_handle((40, 40)))
l.orthogonal = True
c.update_now()
guides = list(Guide(l).horizontal())
self.assertEquals(2, len(guides))
self.assertEquals(10.0, guides[0])
self.assertEquals(40.0, guides[1])
guides = list(Guide(l).vertical())
self.assertEquals(2, len(guides))
self.assertEquals(00.0, guides[0])
self.assertEquals(20.0, guides[1])
示例2: SimpleCanvas
# 需要导入模块: from gaphas.canvas import Canvas [as 别名]
# 或者: from gaphas.canvas.Canvas import update_now [as 别名]
class SimpleCanvas(object):
"""Creates a test canvas object.
Adds a view, canvas, and handle connection tool to a test
case. Two boxes and a line are added to the canvas as well.
"""
def __init__(self):
self.canvas = Canvas()
self.box1 = Box()
self.canvas.add(self.box1)
self.box1.matrix.translate(100, 50)
self.box1.width = 40
self.box1.height = 40
self.box1.request_update()
self.box2 = Box()
self.canvas.add(self.box2)
self.box2.matrix.translate(100, 150)
self.box2.width = 50
self.box2.height = 50
self.box2.request_update()
self.line = Line()
self.head = self.line.handles()[0]
self.tail = self.line.handles()[-1]
self.tail.pos = 100, 100
self.canvas.add(self.line)
self.canvas.update_now()
self.view = GtkView()
self.view.canvas = self.canvas
self.win = Gtk.Window()
self.win.add(self.view)
self.view.show()
self.view.update()
self.win.show()
self.tool = ConnectHandleTool(self.view)