コード例 #1
0
ファイル: 14-place.py プロジェクト: mnabeelp/PyGUI
def main():
    global cb1, cb2, rg

    win = Window(title="Place Me By Your Side", width=720, height=500)

    view1 = TestDrawing(width=320, height=200)

    cb1 = CheckBox(title="Check Me!", action=checked_it)

    cb2 = CheckBox(title="Check Me Too!", action=checked_it)

    rbs = []
    for i in range(1, 4):
        rb = RadioButton(title="Hoopy Option %d" % i, value=i)
        rbs.append(rb)

    rg = RadioGroup(rbs, action=option_chosen)

    pb = Button(title="Push Me!", action=pushed_it)

    view2 = TestScrollableDrawing(width=300, height=300)

    label = Label(text="Flavour:")

    entry = TextField(width=200)

    win.place(view1, left=10, top=10, border=1)

    win.place_row([cb1, cb2], left=10, top=(view1, 20), spacing=20)

    win.place_column(rbs, left=view1 + 20, top=10)

    win.place(pb, right=-20, bottom=-10, anchor='rb')

    win.place(view2,
              left=rbs[0] + 20,
              top=10,
              right=-20,
              bottom=pb - 10,
              scrolling='hv',
              anchor='ltrb',
              border=1)

    win.place(label, left=10, top=(cb1, 20))

    win.place(
        entry,
        left=10,
        top=(label, 10),
        #border = 1
    )
    entry.become_target()

    win.show()

    import GUI
    GUI.run()
コード例 #2
0
ファイル: 16-modal_dialog.py プロジェクト: mnabeelp/PyGUI
def modal_dialog():
    #global dlog ###
    dlog = ModalDialog(title="Spanish Inquisition", size=(200, 140))
    dlog.place(Label(text="Surprise!!!"), left=20, top=20)
    field = TextField()
    dlog.place(field, left=20, top=60, right=-20)
    field.become_target()
    dlog.default_button = DefaultButton()
    dlog.cancel_button = CancelButton()
    dlog.place(dlog.default_button, right=-20, bottom=-20)
    dlog.place(dlog.cancel_button, left=20, bottom=-20)
    dlog.center()
    result = dlog.present()
    say("Result =", result)
    dlog.destroy()
コード例 #3
0
def modal_dialog():
    #global dlog ###
    dlog = ModalDialog(title = "Spanish Inquisition", size = (200, 140))
    dlog.place(Label(text = "Surprise!!!"), left = 20, top = 20)
    field = TextField()
    dlog.place(field, left = 20, top = 60, right = -20)
    field.become_target()
    dlog.default_button = DefaultButton()
    dlog.cancel_button = CancelButton()
    dlog.place(dlog.default_button, right = -20, bottom = -20)
    dlog.place(dlog.cancel_button, left = 20, bottom = -20)
    dlog.center()
    result = dlog.present()
    say("Result =", result)
    dlog.destroy()