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 load_file(self, pobj, arg): myfilename = xfl.fl_show_input("Filename to load", "") if not myfilename or not os.path.exists(myfilename): xfl.fl_load_browser(self.pbr, "") xfl.fl_add_browser_line(self.pbr, "NO SUCH FILE!") else: xfl.fl_load_browser(self.pbr, myfilename)
def db_cb(self, pobj, q): p = xfl.fl_show_input("Enter new database name", self.dbname) if not p or p == self.dbname: return buf = p if self.load_browser(buf): self.dbname = buf xfl.fl_set_object_label(pobj, self.dbname)