def create_chosen_surfs(options, chosen_text_settings):
    """Create surfaces to display the chosen values.

    Each surface represents one of the available values
    for the option menu; the chosen surface representing
    the current value set in the option menu is the one
    used as the 'image' attribute of the option menu itself.
    """
    ### get an arrow surface with the same color as the
    ### foreground color and with the same height as the
    ### font height

    ## prepare arguments used to retrieve the arrow

    arrow_foreground_color = chosen_text_settings["foreground_color"]

    arrow_surf_height = chosen_text_settings["font_height"]

    ## retrieve it

    arrow_surf = get_arrow_surf(arrow_foreground_color, arrow_surf_height)

    ### using the options and the text settings, create
    ### a list of surfaces representing the options
    ### rendered as text surfaces

    chosen_surfs = [
        render_text(str(option), **chosen_text_settings) for option in options
    ]

    ### now calculate a new width for the surfaces, which
    ### is equal to the largest width among the existing
    ### surfaces plus the width of the arrow surface

    new_width = (
        ## largest width among existing surfaces
        max(surf.get_width() for surf in chosen_surfs)
        ## arrow width
        + arrow_surf.get_width()
    )

    ### now iterate over each surface, blitting it over
    ### a new surface created with the new width we
    ### just calculated, and replacing the existing
    ### surface with the new one

    ## define common values for all surfaces;
    ##
    ## note that we arbitrarily increment the height by
    ## 2 pixels, just to create a nice vertical padding
    ## in the new surface when we blit the original
    ## surface over it

    height = chosen_surfs[0].get_height() + 2
    bg_color = chosen_text_settings["background_color"]

    ## iterate over the index of each surface, creating
    ## the a new one and replacing the existing one with
    ## it

    for index in range(len(chosen_surfs)):

        ## retrieve the surface
        text_surf = chosen_surfs[index]

        ## create a new surface with the new width
        new_surf = render_rect(new_width, height, bg_color)

        ## blit the original surface over the new one,
        ## with the midleft coordinates aligned;
        ##
        ## note that we also offset the original surface
        ## 2 pixels to the right before blitting it;
        ##
        ## we do so to produce a nice padding to the
        ## left of the text, since the arrow already
        ## has padding around it that ends up creating
        ## a pleasing space between the text and the
        ## arrow and also between the arrow and the
        ## right edge of the new surface (we'll blit
        ## the arrow just after blitting the original
        ## surface below

        blit_aligned(
            text_surf,
            new_surf,
            retrieve_pos_from="midleft",
            assign_pos_to="midleft",
            offset_pos_by=(2, 0),
        )

        ## now blit the arrow over the new surface,
        ## with its midright aligned with the surface's
        ## midright

        blit_aligned(
            arrow_surf,
            new_surf,
            retrieve_pos_from="midright",
            assign_pos_to="midright",
        )

        ## draw a border around the surface
        draw_border(new_surf)

        ## then replace the original surface with the
        ## new one using the index
        chosen_surfs[index] = new_surf

    ### finally build and return a dictionary containing
    ### the text surfaces we created as values, with the
    ### text for each option (the options converted to
    ### strings) as the keys

    return {str(option): surf for option, surf in zip(options, chosen_surfs)}
Create surfaces to display the chosen values.

    Each surface represents one of the available values
    for the option menu; the chosen surface representing
    the current value set in the option menu is the one
    used as the 'image' attribute of the option menu itself.
    
nodezator/widget/optionmenu/creation.py