コード例 #1
0
 def makeform(self):
     label = ["Red", "Green", "Blue"]
     col = [xfl.FL_RED, xfl.FL_GREEN, xfl.FL_BLUE]
     y = 70
     self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 330)
     pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 45, 15, \
             210, 45, "Color Editor")
     xfl.fl_set_object_lsize(pobj, xfl.FL_LARGE_SIZE)
     for i in range (0, 3):
         self.pdials[i] = xfl.fl_add_dial(xfl.FL_NORMAL_DIAL, 30, y, \
                 60, 60, label[i])
         xfl.fl_set_object_boxtype(self.pdials[i], xfl.FL_UP_BOX)
         xfl.fl_set_dial_bounds(self.pdials[i], 0.0, 255.0)
         xfl.fl_set_dial_value(self.pdials[i], 128.0)
         xfl.fl_set_object_color(self.pdials[i], col[i], xfl.FL_DIAL_COL2)
         xfl.fl_set_object_callback(self.pdials[i], self.cb, i)
         xfl.fl_set_object_return(self.pdials[i], xfl.FL_RETURN_CHANGED)
         self.ptexts[i] = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, y + 17, \
                 50, 25, "128")
         y += 85
     self.presult = xfl.fl_add_box(xfl.FL_DOWN_BOX, 180, 70, 90, 245, "")
     xfl.fl_set_object_color(self.presult, xfl.FL_FREE_COL1, \
             xfl.FL_FREE_COL1)
     xfl.fl_mapcolor(xfl.FL_FREE_COL1, 128, 128, 128)
     xfl.fl_set_object_dblbuffer(self.presult, 1)    # to avoid flicker
     xfl.fl_end_form()
コード例 #2
0
    def create_forms(self):

        self.sample = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 250)

        self.ptrflobj0 = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 250, '')
        xfl.fl_set_object_color(self.ptrflobj0, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.ptrflobj0, xfl.FL_ALIGN_CENTER)
        xfl.fl_set_object_lstyle(self.ptrflobj0, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.ptrflobj0, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.ptrflobj0, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.ptrflobj0, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.ptrflobj0, xfl.FL_NoGravity, xfl.FL_NoGravity)
        self.pdial = xfl.fl_add_dial(xfl.FL_LINE_DIAL, 40, 30, 240, 120, 'A line dial')
        xfl.fl_set_object_boxtype(self.pdial, xfl.FL_FLAT_BOX)
        xfl.fl_set_dial_bounds(self.pdial, 1, 128)
        xfl.fl_set_dial_value(self.pdial, 2.5)
        xfl.fl_set_dial_step(self.pdial, 1)
        xfl.fl_set_dial_angles(self.pdial, 45, 270)
        xfl.fl_set_dial_direction(self.pdial, xfl.FL_DIAL_CCW)
        xfl.fl_set_object_color(self.pdial, xfl.FL_COL1, xfl.FL_RIGHT_BCOL)
        xfl.fl_set_object_lalign(self.pdial, xfl.FL_ALIGN_BOTTOM)
        xfl.fl_set_object_lstyle(self.pdial, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.pdial, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.pdial, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.pdial, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.pdial, xfl.FL_NoGravity, xfl.FL_NoGravity)
        xfl.fl_set_object_shortcut(self.pdial, 'd', 1)
        xfl.fl_set_object_callback(self.pdial, self.dialcb, 7)
        xfl.fl_set_object_return(self.pdial, xfl.FL_RETURN_CHANGED)

        xfl.fl_end_form()
コード例 #3
0
 def makeform(self):
     txt = ["Red", "Green", "Blue"]
     clr = [xfl.FL_RED, xfl.FL_GREEN, xfl.FL_BLUE]
     self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 330)
     pquit = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 45, 15, 210, 45, "A Color Editor")
     xfl.fl_set_object_lsize(pquit, xfl.FL_LARGE_SIZE)
     for i in range(RED, BLUE + 1):
         self.pdial[i] = xfl.fl_add_dial(xfl.FL_LINE_DIAL, 30, 240 - i * 85, 60, 60, txt[i])
         xfl.fl_set_dial_bounds(self.pdial[i], 0.0, 255.0)
         xfl.fl_set_dial_angles(self.pdial[i], 15.0, 345.0)
         xfl.fl_set_dial_value(self.pdial[i], 128.0)
         xfl.fl_set_object_color(self.pdial[i], clr[i], xfl.FL_DIAL_COL2)
         xfl.fl_set_object_return(self.pdial[i], xfl.FL_RETURN_CHANGED)
         xfl.fl_set_object_callback(self.pdial[i], self.dial_callback, i)
         self.ptext[i] = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 255 - i * 85, 50, 25, "128")
     self.presult = xfl.fl_add_box(xfl.FL_DOWN_BOX, 180, 70, 90, 245, "")
     xfl.fl_mapcolor(xfl.FL_FREE_COL1, 128, 128, 128)
     xfl.fl_set_object_color(self.presult, xfl.FL_FREE_COL1, xfl.FL_FREE_COL1)
     xfl.fl_set_object_dblbuffer(self.presult, 1)
     xfl.fl_end_form()
コード例 #4
0
 def makeform(self):
     self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 330)
     self.pbutton = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 45, 15, \
             210, 45, "A Color Editor")
     xfl.fl_set_object_lsize(self.pbutton, xfl.FL_LARGE_SIZE)
     #xfl.fl_set_object_callback(self.pbutton, self.exit_cb, 0)
     self.pred = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 240, 60, 60, "Red")
     xfl.fl_set_dial_bounds(self.pred, 0.0, 255.0)
     xfl.fl_set_dial_value(self.pred, 128.0)
     xfl.fl_set_object_color(self.pred, xfl.FL_DIAL_COL1, xfl.FL_RED)
     xfl.fl_set_object_return(self.pred, xfl.FL_RETURN_CHANGED)
     self.predtext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 255, 50, 25, \
             "")
     self.pgreen = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 155, 60, 60, \
             "Green")
     xfl.fl_set_dial_bounds(self.pgreen, 0.0, 255.0)
     xfl.fl_set_dial_value(self.pgreen, 128.0)
     xfl.fl_set_dial_angles(self.pgreen, 45.0, 360 - 45.0)
     xfl.fl_set_object_color(self.pgreen, xfl.FL_DIAL_COL1, xfl.FL_GREEN)
     xfl.fl_set_object_return(self.pgreen, xfl.FL_RETURN_CHANGED)
     self.pgreentext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 170, 50, \
             25, "")
     self.pblue = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 30, 70, 60, 60, \
             "Blue")
     xfl.fl_set_dial_bounds(self.pblue, 0.0, 255.0)
     xfl.fl_set_dial_value(self.pblue, 128.0)
     xfl.fl_set_object_color(self.pblue, xfl.FL_DIAL_COL1, xfl.FL_BLUE)
     xfl.fl_set_dial_direction(self.pblue, xfl.FL_DIAL_CCW)
     xfl.fl_set_object_return(self.pblue, xfl.FL_RETURN_CHANGED)
     self.pbluetext = xfl.fl_add_box(xfl.FL_DOWN_BOX, 105, 90, 50, 25, "")
     self.presult = xfl.fl_add_box(xfl.FL_DOWN_BOX, 180, 70, 90, 245, "")
     xfl.fl_set_object_color(self.presult, xfl.FL_FREE_COL1, \
             xfl.FL_FREE_COL1)
     xfl.fl_set_object_dblbuffer(self.presult, 1)
     xfl.fl_end_form()