def __init__(self, lsysargv, sysargv):
     self.dcol = 1
     self.on = 1
     xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0)
     pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 400)
     pobj1 = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 320, 20, 40, 30, \
             "Exit")
     xfl.fl_set_object_callback(pobj1, self.done, 0)
     pobj2 = xfl.fl_add_free(xfl.FL_CONTINUOUS_FREE, 40, 80, 320, 280, \
             "", self.handle_free1)
     xfl.fl_end_form()
     depth  = xfl.fl_get_visual_depth()
     if depth < 4:   # Can't do it if less than 4 bit deep...
         print("This Demo requires a depth of at least 4 bits\n")
         xfl.fl_finish()
         sys.exit(1)
     elif depth > 7:     # ...but too large a depth also won't do
         depth = 7
     self.cole = (1 << depth) - 1
     if self.cole > 64:
         self.cole = 64
     pobj2.contents.u_ldata = col = xfl.FL_FREE_COL1
     self.cole += col
     for i in range(col, self.cole + 1):
         j =  255 * (i - col) / (self.cole - col)
         xfl.fl_mapcolor(i, j, j, j)
     xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \
             "Free Object")
     xfl.fl_do_forms()
 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)