本文整理汇总了Python中gaphas.examples.Box.min_width方法的典型用法代码示例。如果您正苦于以下问题:Python Box.min_width方法的具体用法?Python Box.min_width怎么用?Python Box.min_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaphas.examples.Box
的用法示例。
在下文中一共展示了Box.min_width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_canvas
# 需要导入模块: from gaphas.examples import Box [as 别名]
# 或者: from gaphas.examples.Box import min_width [as 别名]
def create_canvas(canvas, title):
# Setup drawing window
view = GtkView()
view.painter = DefaultPainter()
view.canvas = canvas
window = Gtk.Window()
window.set_title(title)
window.set_default_size(400, 400)
win_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
window.add(win_box)
win_box.pack_start(view, True, True, 0)
# Draw first gaphas box
b1 = Box(60, 60)
b1.matrix = (1.0, 0.0, 0.0, 1, 10, 10)
canvas.add(b1)
# Draw second gaphas box
b2 = Box(60, 60)
b2.min_width = 40
b2.min_height = 50
b2.matrix.translate(170, 170)
canvas.add(b2)
# Draw gaphas line
line = Line()
line.matrix.translate(100, 60)
canvas.add(line)
line.handles()[1].pos = (30, 30)
window.show_all()
window.connect("destroy", Gtk.main_quit)
示例2: test_get_handle_at_point
# 需要导入模块: from gaphas.examples import Box [as 别名]
# 或者: from gaphas.examples.Box import min_width [as 别名]
def test_get_handle_at_point(self):
canvas = Canvas()
view = GtkView(canvas)
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.add(view)
window.show_all()
box = Box()
box.min_width = 20
box.min_height = 30
box.matrix.translate(20, 20)
box.matrix.rotate(math.pi/1.5)
canvas.add(box)
i, h = view.get_handle_at_point((20, 20))
assert i is box
assert h is box.handles()[0]