def main(lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) xfl.fl_set_resource(xfl.FLOKLabel, "Go") if xfl.fl_show_question("Do you want bold font ?", 1): xfl.fl_set_goodies_font(xfl.FL_BOLD_STYLE, xfl.FL_NORMAL_SIZE) xfl.fl_show_messages("This is a test program for the goodies of the " "xforms library") xfl.fl_add_timeout(5000, timeout_remove_alert, 0) xfl.fl_show_alert("Alert", "Alert form can be used to inform", \ " about recoverable errors", 0) if xfl.fl_show_question("Do you want to quit?", 0): sys.exit(0) s = xfl.fl_show_input("Enter a string:", "") if not s: s = "" str1 = s xfl.fl_show_message("You typed:", "", str1) choice = xfl.fl_show_choices("Pick a choice", 3, "One", "Two", \ "Three", 2) if choice == 1: xfl.fl_show_message("You typed: One", "", "") elif choice == 2: xfl.fl_show_message("You typed: Two", "", "") elif choice == 3: xfl.fl_show_message("You typed: Three", "", "") else: xfl.fl_show_message("An error occured!", "", "") s = xfl.fl_show_input("Enter another string:", str1) if not s: s = "<Cancel>" str2 = s xfl.fl_show_message("You typed:", "", str2) xfl.fl_show_messages("Good Bye") xfl.fl_finish() return 0
def done_cb(self, pobj, data): if xfl.fl_show_question("Do you want to quit ?", 0): print("will quit after 5 seconds\n") xfl.fl_msleep(5000) xfl.fl_hide_form(pobj.contents.form) xfl.fl_free_form(pobj.contents.form) xfl.fl_finish() sys.exit(0) else: return 0
def button_cb(self, pobj, data): buf = "" if (xfl.fl_get_object_type(pobj) == xfl.FL_HIDDEN_BUTTON): if xfl.fl_show_question("Want to Quit ?", 1) == 1: xfl.fl_finish() sys.exit(0) else: buf = "%s callback called: %d" % (xfl.fl_get_object_label(pobj), \ xfl.fl_get_button(pobj)) xfl.fl_addto_browser(self.br, buf)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.make_form1() xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \ "Demo06") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, self.pbut): if xfl.fl_show_question("Do you really want to Quit?", 0): break xfl.fl_finish() sys.exit(0)
def expired(self, pobj, data): if xfl.fl_show_question("Expired!\n\nQuit?", 0) == 1: xfl.fl_finish() sys.exit(0) else: xfl.fl_set_timer(self.fd_timerform.timer, self.T)