예제 #1
0
def box(pos1, pos2):
    x1, y1 = pos1
    x2, y2 = pos2
    
    return shapes.draggable(
        summon.Region(x1, y1, x2, y2),
        group(color(0, 0, 0, .5),
             shapes.box(x1+4, y1-4, x2+4, y2-4),
             color(0, 1, 0),
             shapes.box(x1, y1, x2, y2),
             color(1, 1, 1),
             shapes.box(x1, y1, x2, y2, fill=False)))
예제 #2
0
파일: drag.py 프로젝트: mdrasmus/summon
#!/usr/bin/env python-i


from summon.core import *
import summon
from summon import shapes



win = summon.Window()

win.add_group(shapes.box(0, 0, 100, 100))

win.add_group(shapes.draggable(
    # region that detects drags
    summon.Region(0, 0, 100, 100),
    # draw group
    group(color(1, 0, 0),
          shapes.round_box(0, 0, 100, 100, 10))))

win.add_group(translate(200, 200, rotate(30, 
    shapes.draggable(
        # region that detects drags
        summon.Region(0, 0, 100, 100),

        # draw group
        group(
            color(0, 0, 1),
            shapes.round_box(0, 0, 100, 100, 10),
            shapes.message_bubble(50, 50, 150, 40, 
                text("hello", 0, 0, 150, 40,
                     "middle", "center"),