def cool(): global f messagebox.show('hello world') f1 = Form(caption="New Form", left=320, top=200) btn1 = Button(f1, caption='Hello', left=5, top=5, width=200, height=100) btn1.on_click = cool2 btn1.background = 'blue' f1.show_modal() print "I'm a cool app"
def handle_exception(ex, stacktrace=None): err_icon = os.path.join(os.path.dirname(__file__), 'graphics', 'icon_error.gif') frm = Form(caption='Exception: {}'.format(ex.__class__.__name__), left=100, top=100, width=350, height=180) frm.resizable = False msg = Label(frm, left=45, top=5, width=305, height=40, caption=ex.message) msg.wordwrap = True img = Image(frm, left=5, top=15, width=32, height=32, file=err_icon) trace = Memo(frm, left=5, top=55, width=335, height=90) trace.text = stacktrace def close_form(): frm.close() btn = Button(frm, left=140, top=148, width=65, height=27, caption="Close") btn.on_click = close_form frm.show_modal()