Пример #1
0
def make_box_for_grid(image_widget, title, size=(250, 250)):
    """
    Make a VBox to hold caption/image for demonstrating
    option_fit values.
    """
    modes = ['oblique', 'X', 'Y', 'Z']

    # make layout
    box_layout = Layout()
    box_layout.width = f'{size[0]}px'
    box_layout.height = f'{size[1]}px'
    box_layout.border = '0px'

    # Make the caption
    if title is not None:
        title_str = "'{}'".format(title)
    else:
        title_str = str(title)

    h = HTML(value='' + str(title_str) + '')

    # Make the box with the image widget inside it
    boxb = Box()
    boxb.layout = box_layout
    boxb.children = [image_widget]

    # Compose into a vertical box
    vb = VBox()
    vb.layout.align_items = 'center'
    vb.children = [h, boxb]

    return vb