def appendObjects(self, top):
    for each_behavior in self.boxlist:
        object_item = SubElement(top, 'behaviors')
        object_id = SubElement(object_item, 'behavior_id')
        object_id.text = str(each_behavior['self_id'])
        name = SubElement(object_item, 'behavior')
        name.text = str(each_behavior['behavior'])
        start = SubElement(object_item, 'start_frame')
        start.text = str(each_behavior['start_frame'])
        if (start.text == ''):
            start.text = 'undefined'
        end = SubElement(object_item, 'end_frame')
        end.text = str(each_behavior['end_frame'])
        if (end.text == ''):
            end.text = 'undefined'
        if (each_behavior['shapes'] != None):
            shapes = SubElement(object_item, 'bounding_boxes')
            for each_shape in each_behavior['shapes']:
                bounding_box = self.convertPoints2BndBox(each_shape.points)
                shape = SubElement(shapes, 'bounding_box')
                frame = SubElement(shape, 'frame')
                frame.text = str(each_shape.filename)
                bndbox = SubElement(shape, 'bndbox')
                xmin = SubElement(bndbox, 'xmin')
                xmin.text = str(bounding_box[0])
                ymin = SubElement(bndbox, 'ymin')
                ymin.text = str(bounding_box[1])
                xmax = SubElement(bndbox, 'xmax')
                xmax.text = str(bounding_box[2])
                ymax = SubElement(bndbox, 'ymax')
                ymax.text = str(bounding_box[3])
def appendObjects(self, top):
    for each_behavior in self.boxlist:
        object_item = SubElement(top, 'behaviors')
        object_id = SubElement(object_item, 'behavior_id')
        object_id.text = str(each_behavior['self_id'])
        name = SubElement(object_item, 'behavior')
        name.text = str(each_behavior['behavior'])
        start = SubElement(object_item, 'start_frame')
        start.text = str(each_behavior['start_frame'])
        if (start.text == ):
            start.text = 'undefined'
        end = SubElement(object_item, 'end_frame')
        end.text = str(each_behavior['end_frame'])
        if (end.text == ):
            end.text = 'undefined'
        if (each_behavior['shapes'] != None):
            shapes = SubElement(object_item, 'bounding_boxes')
            for each_shape in each_behavior['shapes']:
                bounding_box = self.convertPoints2BndBox(each_shape.points)
                shape = SubElement(shapes, 'bounding_box')
                frame = SubElement(shape, 'frame')
                frame.text = str(each_shape.filename)
                bndbox = SubElement(shape, 'bndbox')
                xmin = SubElement(bndbox, 'xmin')
                xmin.text = str(bounding_box[0])
                ymin = SubElement(bndbox, 'ymin')
                ymin.text = str(bounding_box[1])
                xmax = SubElement(bndbox, 'xmax')
                xmax.text = str(bounding_box[2])
                ymax = SubElement(bndbox, 'ymax')
                ymax.text = str(bounding_box[3])