def create_surface_map(self):
        """Return dict w/ surfaces for the widget."""
        ### create ordered dictionaries containing text objs
        ### representing each possible option in both normal
        ### and selected state

        normal_obj_dict = OrderedDict(
            (value, get_option_obj(str(value), self.normal_text_settings))
            for value in self.options
        )

        selected_obj_dict = OrderedDict(
            (value, get_option_obj(str(value), self.selected_text_settings))
            for value in self.options
        )

        ### position the text objects in both dictionaries
        ### side by side and set its topleft to the origin

        for a_dict in (normal_obj_dict, selected_obj_dict):

            objs_rectsman = Iterable2D(a_dict.values().__iter__).rect

            objs_rectsman.snap_rects_ip(
                retrieve_pos_from="bottomright", assign_pos_to="bottomleft"
            )

            objs_rectsman.topleft = (0, 0)

        ### using the last rectsman created (we can use
        ### the rectsman for any of the dicts, since we
        ### are interested only in the size here, not the
        ### appearance) create a base surface to surround
        ### all text objects representing the options

        bg_color = self.normal_text_settings["background_color"]

        base_surf = render_rect(*objs_rectsman.size, bg_color)

        ### now, for each option, blit over a copy of the
        ### base surface all the options, with the selected
        ### option using the "selected" appearance while all
        ### the others use the "normal" appearance, saving
        ### each resulting surface in the surface map with
        ### the selected option as the key

        ## create the surface map
        surface_map = {}

        ## iterate over each option, considering the
        ## one being iterated as the selected one

        for selected_option in self.options:

            ## create copy of base surface
            base_copy = base_surf.copy()

            ## iterate over each option, blitting the
            ## respective surface in the appropriate
            ## state

            for option in self.options:

                ## obtain a text object with a
                ## surface for that option;
                ##
                ## note that we choose the dict based on
                ## whether the option is the selected one
                ## or not, so that we use the selected
                ## surface for the selected option and the
                ## normal surface for the options that are
                ## not selected

                text_obj = (
                    selected_obj_dict if option == selected_option else normal_obj_dict
                )[option]

                ## reference the text object's rect locally
                text_obj_rect = text_obj.rect

                ## blit the surface from the text object in
                ## the copy of the base surface, according
                ## to the position of the object's rect

                base_copy.blit(text_obj.image, text_obj_rect)

                ## blit a line at the left side of the
                ## text obj rect, to make it easier to
                ## perceive different options from each
                ## other

                draw_line(
                    base_copy,
                    OPTION_TRAY_OPTION_SEPARATOR,
                    text_obj_rect.topleft,
                    text_obj_rect.bottomleft,
                    1,
                )

            ## finally draw a black border around the base
            ## surface's copy and store it in the map

            draw_border(base_copy)

            surface_map[selected_option] = base_copy

        ### return the surface map
        return surface_map
Return dict w/ surfaces for the widget.
nodezator/widget/optiontray/creation.py