def create_sorting_button_subform(self, kind_of_content):
        """Create sorting button subform for given kind.

        Parameters
        ==========
        kind_of_content (string)
            either "strings" or "intfloats", which are
            the available kinds of content.
        """
        ### ensure the value of kind_of_content is within
        ### the allowed ones
        assert kind_of_content in ("strings", "intfloats")

        ### depending on the kind of content, define
        ### value, available items and default factory

        if kind_of_content == "strings":

            value = ("a",)
            available_items = {"a", "b", "c"}

            default_factory = lambda: choice(ascii_lowercase)

        elif kind_of_content == "intfloats":

            value = (0,)
            available_items = {0, 1, 2}
            default_factory = lambda: choice(range(100))

        ### define an starting offset
        offset = 5, 30

        ### create list to hold widget
        sorting_button_subform = List2D()

        ### instantiate 'value' argument widgets

        ## define argument name
        arg_name = "value"

        ## instantiate and store text object

        text_obj = get_text_obj(reference_rect=self.rect, offset=offset, text=arg_name)

        sorting_button_subform.append(text_obj)

        ## define needed arguments, instantiate and store
        ## sorting button widget for the 'value' sorting
        ## button

        # define widget name
        widget_name = arg_name

        offset = 60, offset[1] + 5
        coordinates_name = "topleft"
        coordinates_value = self.rect.move(offset).topleft

        value_sorting_button = SortingButton(
            name=widget_name,
            value=value,
            available_items=available_items,
            coordinates_name=coordinates_name,
            coordinates_value=coordinates_value,
        )

        sorting_button_subform.append(value_sorting_button)

        ### instantiate 'available items' argument widgets

        ## define argument name
        arg_name = "available_items"

        ## update offset
        offset = 5, offset[1] + 25

        ## instantiate and store text object

        text_obj = get_text_obj(
            reference_rect=self.rect,
            offset=offset,
            text=arg_name,
        )

        sorting_button_subform.append(text_obj)

        ## define needed arguments, instantiate and store
        ## list widget for the option tray 'options'

        # define widget name
        widget_name = arg_name

        # define position data

        offset = 80, offset[1] + 5 + 20  # 20 added
        coordinates_name = "topleft"
        coordinates_value = self.rect.move(offset).topleft

        # define widget factory

        if kind_of_content == "strings":

            widget_factory = partial(
                StringEntry,
                loop_holder=self,
                draw_on_window_resize=self.draw,
                name="available_item",
            )

        elif kind_of_content == "intfloats":

            widget_factory = partial(
                IntFloatEntry,
                value=0,
                loop_holder=self,
                draw_on_window_resize=self.draw,
                name="available_item",
                allow_none=False,
            )

        # instantiate and store widget list

        items_set_widget = SetWidget(
            name=widget_name,
            value=list(available_items),
            min_len=1,
            widget_factory=widget_factory,
            default_factory=default_factory,
            quantity_command=(self.reposition_form_elements),
            coordinates_name=coordinates_name,
            coordinates_value=coordinates_value,
        )

        sorting_button_subform.append(items_set_widget)

        ### create custom command for list widget and
        ### assign it to its 'command' attribute

        def command():
            """Updates values in the sorting button.

            Values of the sorting button are updated with
            the values in the list widget whenever the user
            edits values in the list widget.
            """
            ### retrieve values

            set_widget_values = items_set_widget.get()

            available_items = value_sorting_button.available_items

            ### if items in the list widget are different
            ### than those on the sorting button, update
            ### the available items on the sorting button

            if set_widget_values and set_widget_values != available_items:

                sorting_button_value = value_sorting_button.get()

                value = (
                    sorting_button_value
                    if set(sorting_button_value).issubset(set_widget_values)
                    else tuple(set_widget_values)[:1]
                )

                (
                    value_sorting_button.reset_value_and_available_items(
                        value=value,
                        available_items=(set_widget_values),
                    )
                )

        items_set_widget.command = command

        ### format the subform key according to the kind
        ### of content used

        subform_key = "sorting_button_with_{}".format(kind_of_content)

        ### finally store the subform list in the map
        self.subform_map[subform_key] = sorting_button_subform
Create sorting button subform for given kind.

        Parameters
        ==========
        kind_of_content (string)
            either "strings" or "intfloats", which are
            the available kinds of content.
        
nodezator/editing/widgetpicker/subforms.py