from GUI import Window, ModalDialog, Label, Button, application

def modal_dialog():
    dlog = ModalDialog(title = "Spanish Inquisition", size = (200, 100))
    dlog.place(Label(text = "Surprise!!!"), left = 20, top = 20)
    def ok():
        dlog.dismiss(42)
    dlog.default_button = Button(title = "OK", action = ok)
    dlog.place(dlog.default_button, right = -20, bottom = -20)
    dlog.center()
    result = dlog.present()
    print "Result =", result
    dlog.destroy()

win = Window(title = "Modal Dialogs", size = (200, 60))
dialog_button = Button(title = "Give Me A Dialog", action = modal_dialog)
win.place(dialog_button, left = 20, top = 20)
win.show()

application().run()
