示例#1
0
文件: shapes.py 项目: mdrasmus/summon
from summon.core import *
from summon import shapes, colors

win = summon.Window()

win.add_group(
    group(colors.white,
          shapes.round_box(0, 0, 100, 100, 20, fill=False),
          shapes.box(0, 0, 100, 100, fill=False)))

win.add_group(translate(200, 0,
    colors.red,
    shapes.round_box(0, 0, 100, 100, [20, 20, 40, 40])))

win.add_group(translate(400, 0,
    colors.white,
    shapes.message_bubble(0, 0, 150, 100,
        group(colors.blue,
            text("hello world", 0, 0, 150, 100, "center", "middle")),
        close_button=True)))

win.add_group(translate(400, -400,
    colors.white,
    shapes.message_bubble(0, 0, 150, 40,
        group(colors.blue,
            text("hello world", 0, 0, 150, 40, "center", "middle")),
        close_button=True)))
     
    
win.home()
示例#2
0
文件: drag.py 项目: mdrasmus/summon
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"),
                close_button=True))))))

                              
win.add_binding(input_click("left", "up", "shift"), "hotspot_drag_stop")
win.add_binding(input_click("left", "down", "shift"), "hotspot_drag_start")
win.add_binding(input_motion("left", "down", "shift"), "hotspot_drag")