def main(lsysargv, sysargv): sc = 1.0 xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) ui = create_form_form() strng = "%.2f" % sc xfl.fl_set_input(ui.pscaleobj, strng) xfl.fl_show_form(ui.pform, xfl.FL_PLACE_CENTER | xfl.FL_FREE_SIZE, xfl.FL_FULLBORDER, "Scaling") while True: oldsc = sc pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, ui.pexitobj): sys.exit(0) elif xfl.fl_is_same_object(pobj, ui.psmallerobj): sc = sc * 0.8 elif xfl.fl_is_same_object(pobj, ui.plargerobj): sc = sc / 0.8 elif xfl.fl_is_same_object(pobj, ui.pscaleobj): sc = float(xfl.fl_get_input(ui.pscaleobj)) if sc < 0.50: sc = 0.50 elif sc > 3: sc = 3 if sc != oldsc: xfl.fl_scale_form(ui.pform, sc / oldsc, sc / oldsc) xfl.fl_redraw_form(ui.pform) # to avoid garbage on screen strng = "%.2f" % sc xfl.fl_set_input(ui.pscaleobj, strng)
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 130, 100) self.pbr = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 5, 5, 95, 90, \ "") pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 5, 20, 8, \ "Exit") pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 75, 20, 8, \ "Load") xfl.fl_set_object_callback(pobj, self.load_file, 0) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 60, 20, 8, \ "Small") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_SMALL_SIZE) xfl.fl_call_object_callback(pobj) xfl.fl_set_button(pobj, 1) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 50, 20, 8, \ "Normal") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_NORMAL_SIZE) pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 40, 20, 8, \ "Large") xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_LARGE_SIZE) xfl.fl_end_form() xfl.fl_scale_form(pform, 4.0, 4.0) xfl.fl_adjust_form_size(pform) xfl.fl_clear_browser(self.pbr) xfl.fl_add_browser_line(self.pbr, "LOAD A FILE.") xfl.fl_show_form(pform, xfl.FL_PLACE_FREE, xfl.FL_FULLBORDER, \ "Browser") while True: pobj = xfl.fl_do_forms() if xfl.fl_is_same_object(pobj, pbut): break xfl.fl_hide_form(pform) xfl.fl_finish()
def __init__(self, lsysargv, sysargv): xfl.fl_set_border_width(-3) xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.ui = self.create_form_fontsform() xfl.fl_scale_form(self.ui.pfontsform, 1.1, 1.2) xfl.fl_set_object_dblbuffer(self.ui.ptextobj, 1) xfl.fl_set_object_bw(self.ui.ptextobj, 5) nfnt = xfl.fl_enumerate_fonts(self.addit, 1) xfl.fl_select_browser_line(self.ui.pfontobj, 1) xfl.fl_addto_browser(self.ui.psizeobj, "8 (tiny)") xfl.fl_addto_browser(self.ui.psizeobj, "10 (small)") xfl.fl_addto_browser(self.ui.psizeobj, "11 (scaled)") xfl.fl_addto_browser(self.ui.psizeobj, "12 (normal)") xfl.fl_addto_browser(self.ui.psizeobj, "13 (scaled)") xfl.fl_addto_browser(self.ui.psizeobj, "14 (medium)") xfl.fl_addto_browser(self.ui.psizeobj, "18 (large)") xfl.fl_addto_browser(self.ui.psizeobj, "24 (Huge)") xfl.fl_addto_browser(self.ui.psizeobj, "30 (scaled)") xfl.fl_select_browser_line(self.ui.psizeobj, 2) xfl.fl_set_object_lstyle(self.ui.ptextobj, xfl.FL_NORMAL_STYLE) xfl.fl_call_object_callback(self.ui.pfontobj) xfl.fl_call_object_callback(self.ui.psizeobj) xfl.fl_show_form(self.ui.pfontsform, xfl.FL_PLACE_CENTER, \ xfl.FL_TRANSIENT, "Fonts") xfl.fl_do_forms()
def __init__(self, lsysargv, sysargv): xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) self.makeform() xfl.fl_scale_form(self.pform, 4.0, 4.0) xfl.fl_show_form(self.pform, xfl.FL_PLACE_FREE, \ xfl.FL_TRANSIENT, "colsel") while True: pret = xfl.fl_do_forms() if xfl.fl_is_same_object(pret, self.ptopbox): break xfl.fl_hide_form(self.pform) xfl.fl_finish() sys.exit(0)
def create_form_clock(self): if self.pfclock: return self.pfclock = xfl.fl_bgn_form(xfl.FL_NO_BOX, 500, 350) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 500, 350, "") pobj = xfl.fl_add_clock(xfl.FL_DIGITAL_CLOCK, 185, 20, 150, 35, "") xfl.fl_set_object_boxtype(pobj, xfl.FL_ROUNDED_BOX) xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_BLACK) xfl.fl_set_object_lsize(pobj, xfl.FL_MEDIUM_SIZE) xfl.fl_set_object_lstyle(pobj, xfl.FL_BOLD_STYLE) pobj = xfl.fl_add_clock(xfl.FL_ANALOG_CLOCK, 30, 70, 220, 200, "") xfl.fl_set_object_boxtype(pobj, xfl.FL_UP_BOX) pobj = xfl.fl_add_clock(xfl.FL_ANALOG_CLOCK, 260, 70, 220, 200, "") xfl.fl_set_object_boxtype(pobj, xfl.FL_OVAL3D_UPBOX) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 375, 300, 110, 35, \ "Exit") xfl.fl_set_object_callback(pobj, self.exit_cb, 0) xfl.fl_end_form() xfl.fl_scale_form(self.pfclock, 0.7, 0.7)
def create_form_cl(self): if self.pcl: return self.pcl = xfl.fl_bgn_form(xfl.FL_NO_BOX, 330, 385) pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 330, 385, "") xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_COL1) pobj = xfl.fl_add_box(xfl.FL_NO_BOX, 40, 10, 250, 30, "Color Browser") xfl.fl_set_object_lcol(pobj, xfl.FL_RED) xfl.fl_set_object_lsize(pobj, xfl.FL_HUGE_SIZE) xfl.fl_set_object_lstyle(pobj, xfl.FL_BOLD_STYLE + xfl.FL_SHADOW_STYLE) xfl.fl_set_object_gravity(pobj, xfl.FL_North, xfl.FL_North) xfl.fl_set_object_resize(pobj, xfl.FL_RESIZE_NONE) self.pdbobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 50, \ 250, 25, "") xfl.fl_set_object_boxtype(self.pdbobj, xfl.FL_BORDER_BOX) if xfl.fl_get_visual_depth() == 1: tmpcolr = xfl.FL_WHITE else: tmpcolr = xfl.FL_COL1 xfl.fl_set_object_color(self.pdbobj, tmpcolr, xfl.FL_COL1) xfl.fl_set_object_callback(self.pdbobj, self.db_cb, 0) xfl.fl_set_object_gravity(self.pdbobj, xfl.FL_North, xfl.FL_North) xfl.fl_set_object_resize(self.pdbobj, xfl.FL_RESIZE_X) self.prescol = xfl.fl_add_box(xfl.FL_FLAT_BOX, 225, 90, 90, 35, "") xfl.fl_set_object_color(self.prescol, xfl.FL_FREE_COL4, \ xfl.FL_FREE_COL4) xfl.fl_set_object_boxtype(self.prescol, xfl.FL_BORDER_BOX) xfl.fl_set_object_resize(self.prescol, xfl.FL_RESIZE_NONE) xfl.fl_set_object_gravity(self.prescol, xfl.FL_NorthEast, \ xfl.FL_East) self.prs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 225, 130, \ 30, 200, "") xfl.fl_set_object_color(self.prs, xfl.FL_COL1, xfl.FL_RED) xfl.fl_set_slider_bounds(self.prs, 0, 255) xfl.fl_set_slider_precision(self.prs, 0) xfl.fl_set_object_callback(self.prs, self.search_rgb, 0) #xfl.fl_set_object_return(self.prs, 0) xfl.fl_set_object_resize(self.prs, xfl.FL_RESIZE_Y) xfl.fl_set_object_gravity(self.prs, xfl.FL_NorthEast, \ xfl.FL_SouthEast) xfl.fl_set_object_return(self.prs, xfl.FL_RETURN_CHANGED) self.pgs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 255, 130, \ 30, 200, "") xfl.fl_set_object_color(self.pgs, xfl.FL_COL1, xfl.FL_GREEN) xfl.fl_set_slider_bounds(self.pgs, 0, 255) xfl.fl_set_slider_precision(self.pgs, 0) xfl.fl_set_object_callback(self.pgs, self.search_rgb, 1) #xfl.fl_set_object_return(self.pgs, 0) xfl.fl_set_object_resize(self.pgs, xfl.FL_RESIZE_Y) xfl.fl_set_object_gravity(self.pgs, xfl.FL_NorthEast, \ xfl.FL_SouthEast) xfl.fl_set_object_return(self.pgs, xfl.FL_RETURN_CHANGED) self.pbs = xfl.fl_add_valslider(xfl.FL_VERT_FILL_SLIDER, 285, 130, \ 30, 200, "") xfl.fl_set_object_color(self.pbs, xfl.FL_COL1, xfl.FL_BLUE) xfl.fl_set_slider_bounds(self.pbs, 0, 255) xfl.fl_set_slider_precision(self.pbs, 0) xfl.fl_set_object_callback(self.pbs, self.search_rgb, 2) #xfl.fl_set_object_return(self.pbs, 0) xfl.fl_set_object_resize(self.pbs, xfl.FL_RESIZE_Y) xfl.fl_set_object_gravity(self.pbs, xfl.FL_NorthEast, \ xfl.FL_SouthEast) xfl.fl_set_object_return(self.pbs, xfl.FL_RETURN_CHANGED) self.pcolbr = xfl.fl_add_browser(xfl.FL_HOLD_BROWSER, 10, 90, \ 205, 240, "") xfl.fl_set_browser_fontstyle(self.pcolbr, xfl.FL_FIXED_STYLE) xfl.fl_set_object_callback(self.pcolbr, self.br_cb, 0) xfl.fl_set_object_gravity(self.pcolbr, xfl.FL_NorthWest, \ xfl.FL_SouthEast) pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 135, 345, \ 80, 30, "Done") xfl.fl_set_object_callback(pobj, self.done_cb, 0) xfl.fl_set_object_gravity(pobj, xfl.FL_South, xfl.FL_South) xfl.fl_set_object_resize(pobj, xfl.FL_RESIZE_NONE) xfl.fl_end_form() xfl.fl_scale_form(self.pcl, 1.1, 1.0)