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.bitmapname = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 40, 30, 250, 100, 'bitmap')
        xfl.fl_set_object_boxtype(self.bitmapname, xfl.FL_NO_BOX)
        xfl.fl_set_bitmap_file(self.bitmapname, './bm2.xbm')
        xfl.fl_set_object_color(self.bitmapname, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.bitmapname, xfl.FL_ALIGN_BOTTOM)
        xfl.fl_set_object_lstyle(self.bitmapname, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.bitmapname, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.bitmapname, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.bitmapname, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.bitmapname, xfl.FL_NoGravity, xfl.FL_NoGravity)
        xfl.fl_set_object_shortcut(self.bitmapname, 'b', 1)
        xfl.fl_set_object_callback(self.bitmapname, self.bitmapcb, 2)

        xfl.fl_end_form()
 def load_file(self, fname, pvdata):
     #ldata = xfl.fls_convert_ptrvoid_to_ptrlongc(pvdata).contents.value
     #print("ldata", ldata)
     if not fname or not os.path.exists(fname):
         print("Missing file name\n")
         return 0
     fnameonly = os.path.basename(fname)
     if os.path.isdir(fname):
         xfl.fl_set_directory(fname)
     else:   # a file
         p, ext = os.path.splitext(fnameonly)
         if not ext:
             print("Missing file extension\n")
             return 0
         else:
             if fname.endswith(b".xpm"):
                 xfl.fl_hide_object(self.fd_ttt.bm)
                 xfl.fl_free_pixmap_pixmap(self.fd_ttt.pm)
                 xfl.fl_set_pixmap_file(self.fd_ttt.pm, fname)
                 xfl.fl_show_object(self.fd_ttt.pm)
             elif fname.endswith(b".xbm"):
                 xfl.fl_hide_object(self.fd_ttt.pm)
                 xfl.fl_set_bitmap_file(self.fd_ttt.bm, fname)
                 xfl.fl_show_object(self.fd_ttt.bm)
             else:
                 message = "Invalid file extension, neither" \
                         ".xpm nor .xbm file: %s\n" % ext
                 print(message)
                 return 0
     return 1
def main(lsysargv, sysargv):
    xfl.fl_initialize(lsysargv, sysargv, "FormDemo", 0, 0 )
    pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 200, 200)
    pobj = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 50, 50, 100, 100, \
            "A bitmap")
    xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE)
    xfl.fl_add_button(xfl.FL_HIDDEN_BUTTON, 50, 50, 100, 100, "")
    xfl.fl_end_form()
    xfl.fl_set_bitmap_file(pobj, bmpfilename)
    xfl.fl_show_form(pform, xfl.FL_PLACE_MOUSE, xfl.FL_NOBORDER, \
            "X Bitmap")
    xfl.fl_do_forms()
    xfl.fl_hide_form(pform)
    xfl.fl_finish()
    return 0
 def create_form_staticform(self):
     fdui = FD_staticform()
     fdui.staticform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 431, 211)
     pobj = xfl.fl_add_box(xfl.FL_FLAT_BOX, 0, 0, 431, 211, "")
     xfl.fl_set_object_color(pobj, xfl.FL_INDIANRED, xfl.FL_INDIANRED)
     xfl.fl_set_object_lcolor(pobj, xfl.FL_INDIANRED)
     pobj1 = xfl.fl_add_box(xfl.FL_UP_BOX, 40, 40, 60, 45, "A Box")
     pobj2 = xfl.fl_add_labelframe(xfl.FL_ENGRAVED_FRAME, 130, 30, 120, 55, "LabelFrame")
     xfl.fl_set_object_color(pobj2, xfl.FL_BLACK, xfl.FL_INDIANRED)
     xfl.fl_set_object_lstyle(pobj2, xfl.FL_BOLD_STYLE)
     fdui.chart = xfl.fl_add_chart(xfl.FL_PIE_CHART, 270, 20, 130, 105, "")
     xfl.fl_set_object_color(fdui.chart, xfl.FL_INDIANRED, xfl.FL_COL1)
     pobj3 = xfl.fl_add_clock(xfl.FL_ANALOG_CLOCK, 30, 100, 85, 85, "")
     xfl.fl_set_object_color(pobj3, xfl.FL_COL1, xfl.FL_RIGHT_BCOL)
     pobj4 = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 150, 140, 30, 25, "")
     xfl.fl_set_bitmap_file(pobj4, "srs.xbm")
     pobj5 = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 210, 120, 60, 60, "")
     xfl.fl_set_pixmap_file(pobj5, "porsche.xpm")
     pobj6 = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 310, 150, 70, 25, "Text")
     xfl.fl_set_object_boxtype(pobj6, xfl.FL_BORDER_BOX)
     xfl.fl_end_form()
     return fdui
 def test_fl_set_bitmap_file__fail3(self):
     # failing: 2nd arg missing
     self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name
     xfl.fl_set_bitmap_file(self.bitobj)
 def test_fl_set_bitmap_file__fail2(self):
     # failing: 1st and 2nd args of unfit type
     self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name
     xfl.fl_set_bitmap_file(102, self.bitobj)
 def test_fl_set_bitmap_file__ok(self):
     # test should NOT fail
     self.statusmsg = "%s: should NOT fail." % \
             sys._getframe().f_code.co_name
     xbmfile = "prova.xbm"
     xfl.fl_set_bitmap_file(self.bitobj, xbmfile)