Пример #1
0
 def handle_free1(self, pobj, event, mx, my, key, ev):
     if event == xfl.FL_DRAW:
         xfl.fl_rectf(pobj.contents.x, pobj.contents.y, pobj.contents.w, \
                 pobj.contents.h, pobj.contents.u_ldata)
     elif event == xfl.FL_RELEASE:
         self.on = not self.on
     elif event == xfl.FL_STEP:
         if self.on:
             if pobj.contents.u_ldata >= self.cole:
                 self.dcol = -1
             elif pobj.contents.u_ldata <= xfl.FL_FREE_COL1:
                 self.dcol = 1
             pobj.contents.u_ldata += self.dcol
             xfl.fl_redraw_object(pobj)
     return 0
Пример #2
0
 def drawit(self, stobj):
     xfl.fl_winset(self.main_win)
     xfl.fl_mapcolor(xfl.FL_FREE_COL1, stobj.r, \
                 stobj.g, stobj.b)
     if stobj.type == 1:
         xfl.fl_rectf(stobj.x - stobj.size, \
                 stobj.y - stobj.size, 2 * stobj.size, \
                 2 * stobj.size, xfl.FL_FREE_COL1)
     elif stobj.type == 2:
         xfl.fl_circf(stobj.x, stobj.y, stobj.size, \
                 xfl.FL_FREE_COL1)
     elif stobj.type == 3:
         mylistpoint = [ \
                 {'x':int(stobj.x - stobj.size), \
                 'y':int(stobj.y + stobj.size)}, \
                 {'x':int(stobj.x + stobj.size), \
                 'y':int(stobj.y + stobj.size)}, \
                 {'x':int(stobj.x), \
                 'y':int(stobj.y - stobj.size)}]
         pxpoint = xfl.fls_make_ptr_flpoint(mylistpoint)
         xfl.fl_polyf(pxpoint, 3, xfl.FL_FREE_COL1)