def createField(self, key, value):
        """
        Creates a field matching the input type.
        :param key, key to store the value in, also the name of the label if type is float or int.
        :param value, default value for the field.
        """
        doNotTranslate = bool(hasattr(self.tool.brushMode, "trn"))
        check_value = value
        mi = 0
        ma = 100
        if key in ('W', 'H', 'L'):
            reference = AttrRef(self.tool, key)
        else:
            reference = ItemRef(self.tool.options, key)
        if isinstance(check_value, tuple):
            check_value = value[0]
            mi = value[1]
            ma = value[2]
        if isinstance(check_value, Block):
            if key not in self.tool.recentBlocks:
                self.tool.recentBlocks[key] = []
            wcb = getattr(self.tool.brushMode, 'wildcardBlocks', [])
            aw = False
            if key in wcb:
                aw = True
            field = BlockButton(self.tool.editor.level.materials,
                                ref=reference,
                                recentBlocks=self.tool.recentBlocks[key],
                                allowWildcards=aw
                                )
        elif isinstance(check_value, types.MethodType):
            field = Button(key, action=value)
        else:
            if doNotTranslate:
                key = self.tool.brushMode.trn._(key)
                value = self.tool.brushMode.trn._(value)
            if isinstance(check_value, int):
                field = IntInputRow(key, ref=reference, width=50, min=mi, max=ma, doNotTranslate=doNotTranslate)
            elif isinstance(check_value, float):
                field = FloatInputRow(key, ref=reference, width=50, min=mi, max=ma, doNotTranslate=doNotTranslate)
            elif isinstance(check_value, bool):
                field = CheckBoxLabel(key, ref=reference, doNotTranslate=doNotTranslate)
            elif isinstance(check_value, str):
                field = Label(value, doNotTranslate=doNotTranslate)
            else:
                print type(check_value)
                field = None
        return field

        Creates a field matching the input type.
        :param key, key to store the value in, also the name of the label if type is float or int.
        :param value, default value for the field.
        
editortools/brush.py