Exemplo n.º 1
0
    rb.append(RadioButton(kind.capitalize(), value=kind, group=rg))
rg.set_value('stop')
pb = [
    Button(title="Alert", action=do_alert),
    Button(title="Alert2", action=do_alert2),
    Button(title="Alert3", action=do_alert3),
]
pb2 = [
    Button("Note Alert", action=do_note_alert),
    Button("Stop Alert", action=do_stop_alert),
    Button("Ask", action=do_ask),
    Button("Confirm", action=do_confirm),
    Button("Ask or Cancel", action=do_ask_or_cancel),
    Button("Confirm or Cancel", action=do_confirm_or_cancel),
]
win.place_column(pb, left=20, top=20)
win.place_column(rb, left=pb[2] + 20, top=20)
win.place_column(pb2, left=rb[1].right + 20, top=20)
win.size = (pb2[-1].right + 20, pb2[-1].bottom + 20)
win.show()

instructions = """
This lets you play around with the various standard dialog functions.
Consult the documentation for details of how they should behave. Check
that appropriate icons are displayed for the different flavours according
to platform conventions.
"""

say(instructions)
application().run()
Exemplo n.º 2
0
#say("Setting lbls[0].position to (20, 20)")
#say("Before: lbls[0].bounds =", lbls[0].bounds)
lbls[0].position = (20, 20)
#say("After: lbls[0].bounds =", lbls[0].bounds)
lbls[1].position = (lbls[0].right, lbls[0].top)
for i in range(2, len(lbls)):
    lbls[i].position = (lbls[0].left, lbls[i-1].bottom + 20)

#for lbl in lbls:
#	say(lbl.height)

#say("Creating window")
win = Window(title = "Labels")
for lbl in lbls:
    win.add(lbl)
win.size = (lbls[-1].right + 20, lbls[-1].bottom + 20)
win.show()

instructions = """
There should be six rows of labels:
1. Two labels "ParrotState:" and "Resting", abutting but not overlapping.
2. A two-line label "Spam!\\nGlorious Spam!"
3. A label "Red" in red text.
4. A label "Big Italic" in a large italic font.
5. A two-line label "Pig in the\\nMiddle" centred in the window.
6. A two-line label "Right\\nJustified" right-aligned.
All labels should remain stationary relative to the top left corner
of the window when it is resized.
"""

say(instructions)