示例#1
0
    def __init__(self, **params):
        self.ev_manager = params['ev_manager']
        self.ev_manager.register_listener(self)
        title = gui.Label("Board is being generated...")
        main = gui.Table()

        main.tr()
        main.td(gui.Label("Your travel agents are working overtime."))
        main.tr()
        self.progress_bar = gui.ProgressBar(0, 0, 10, width=200)
        main.td(self.progress_bar)

        gui.Dialog.__init__(self, title, main)
示例#2
0
c.add(gui.Label("Click on Cuzco's Face!"), 0, 0)

img = gui.Image("cuzco.png")


def myfnc(_event, _widget, _code, a, b, c):
    print(_event, _widget, _code, a, b, c)
    pos = _event.pos
    img.value.fill((255, 0, 0), (pos[0], pos[1], 2, 2))
    img.repaint()
    t.tr()
    t.td(gui.Label(str(("point at ", pos))))
    prog.value += 1
    #box.resize()
    #box.set_vertical_scroll()


img.connect(gui.CLICK, myfnc, 1, 2, 3)

c.add(img, 20, 20)

t = gui.Table()
box = gui.ScrollArea(t, 300, 240)
c.add(box, 10, 120)

prog = gui.ProgressBar(10, 0, 40, width=200)
c.add(prog, 50, 400)

app.connect(gui.QUIT, app.quit, None)
app.run(c)
示例#3
0
文件: pgu_lam.py 项目: mthaak/yaac
def make_gui():
    global pb, font, textArea, lines

    font = pygame.font.SysFont("default", 18)
    fontBig = pygame.font.SysFont("default", 24)
    fontSub = pygame.font.SysFont("default", 20)
    theme = pgui.Theme('test_theme')

    # create GUI object
    gui = pgui.App(theme=theme)
    textArea = pygame.Rect(390, 20, 250, 320)

    # layout using document
    lo = pgui.Container(width=screenSize[0])

    # create page label
    # lo.block(align=-1) #lo.br(8) #lo.tr()
    title = pgui.Label("Pygame GUI Test Page - PGU", font=fontBig)
    lo.add(title, 29, 13)

    # create progress bar label
    # progress bar
    pbl = pgui.Label('Progress Bar')
    lo.add(pbl, 354, 351)
    pb = pgui.ProgressBar(10, 0, 100, width=200)
    lo.add(pb, 354, 371)

    # create checkbuttons and add to gui
    cbt = pgui.Table()
    cb1 = pgui.Switch()
    cb1.connect(pgui.CHANGE, logCheckAction, (cb1, "Check Box 1"))
    cb1l = pgui.Label("Check Box 1")
    cbt.add(cb1)
    cbt.add(cb1l)
    cbt.tr()
    cb2 = pgui.Switch()
    cb2.connect(pgui.CHANGE, logCheckAction, (cb2, "Check Box 2"))
    cb2l = pgui.Label("Check Box 2")
    cbt.add(cb2)
    cbt.add(cb2l)
    cbt.tr()
    cb3 = pgui.Switch()
    cb3.connect(pgui.CHANGE, logCheckAction, (cb3, "Check Box 3"))
    cb3l = pgui.Label("Check Box 3")
    cbt.add(cb3)
    cbt.add(cb3l)
    lo.add(cbt, 52, 52)

    # create radio buttons, put in table, and add to gui
    rbt = pgui.Table()
    radio = pgui.Group()
    rb1 = pgui.Radio(radio, 1)
    rb1l = pgui.Label("Radio Button 1")
    rbt.add(rb1)
    rbt.add(rb1l)
    rbt.tr()
    rb2 = pgui.Radio(radio, 2)
    rb2l = pgui.Label("Radio Button 2")
    rbt.add(rb2)
    rbt.add(rb2l)
    rbt.tr()
    rb3 = pgui.Radio(radio, 3)
    rb3l = pgui.Label("Radio Button 3")
    rbt.add(rb3)
    rbt.add(rb3l)
    rbt.tr()
    lo.add(rbt, 210, 52)
    radio.connect(pgui.CHANGE, logRadioAction, (radio, "Radio Button 3"))

    # create txt box label
    txtl = pgui.Label("Text Box", font=fontSub)
    lo.add(txtl, 30, 127)
    # create text box
    txt = pgui.Input("next line of input", size=40)
    txt.connect(pgui.BLUR, logInputAction, txt)
    lo.add(txt, 28, 149)

    # add buttons, both regular and toggle
    btn1 = pgui.Button("Button 1")
    btn1.connect(pgui.CLICK, logButtonAction, ("Button 1 clicked"))
    lo.add(btn1, 36, 250)
    btn2 = pgui.Button("Button 2")
    btn2.connect(pgui.CLICK, logButtonAction, ("Button 2 clicked"))
    lo.add(btn2, 133, 250)
    btn3 = pgui.Button("Button 3")
    btn3.connect(pgui.CLICK, logButtonAction, ("Button 3 clicked"))
    lo.add(btn3, 230, 250)

    # create toggle button not avail label
    tbl = pgui.Label("Toggle Buttons Not Supported")
    lo.add(tbl, 36, 290)

    img = pgui.Image("clear.png")
    img.connect(pgui.CLICK, logImg)
    # iml = pgui.Label("Image Map Not Supported")
    lo.add(img, 36, 340)

    # create slider label
    sll = pgui.Label("Slider", font=fontSub)
    lo.add(sll, 36, 195)
    # create slider
    sl = pgui.HSlider(value=1, min=0, max=100, size=32, width=200, height=16)
    sl.connect(pgui.CHANGE, logSliderAction, sl)
    lo.add(sl, 53, 210)  # , colspan=3)

    # make some insensitive
    btn2.disabled = True
    cb3.disabled = True

    # clear setup noise, and put initial content in
    lines = []
    lines.append('top line of input')
    lines.append('second line of input')
    progBar(pb, lines)  # update progress bar for above two items

    gui.init(lo)

    return gui