def text(self, value): self.__edited = True Functions.TypeCheck(value, [String, type(None)], "text") self.__text = value self.text._String__owner = self self.text._String__imageChanged = True TransformText(self)
def SetColor(value, varName, className): Functions.TypeCheck(value, [tuple, type(None)], varName, className) output = None if (value != None): temp = [] max = -1 for i in value: if (i < 0): Functions.Err("color cant have a negative value") if (i > max): max = i temp.append(i) value = temp if (max > 255): for i in range(len(value)): value[i] = value[i] / max * 255 if (value == None or len(value) == 4): output = (float(value[0]), float(value[1]), float(value[2]), float(value[3])) elif (len(value) == 3): output = (float(value[0]), float(value[1]), float(value[2]), 255.0) else: Functions.Err( className + "." + varName + " must have a length of 3 or 4 in RGBA or RGB format") return output
def height(self, value): Functions.TypeCheck(value, [float, int], "height", "Rect") self.__height = float(value) UpdateRects(self) if (self.__owner != None and not self.__global): self.__owner._Object__transformed = True TransformText(self.__owner) SetEdited(self)
def rect(self, value): SetObjEdited(self) Functions.TypeCheck(value, Rect, "rect") self.__rect = value self.__rect._Rect__owner = self self.__rect._Rect__global = False UpdateRects(self.__rect) self.__transformed = True TransformText(self)
def fontSize(self, value): Functions.TypeCheck(value, [int, float], "fontSize", "String") self.__fontSize = value self.__rowChanged = True SetEdited(self)
def text(self, value): Functions.TypeCheck(value, str, "text", "String") self.__text = value self.__rowChanged = True SetEdited(self)
def addDash(self, value): Functions.TypeCheck(value, bool, "addDash", "String") self.__addDash = value self.__rowChanged = True
def alignment(self, value): Functions.TypeCheck(value, int, "alignment", "String") self.__alignment = value self.__imageChanged = True SetEdited(self)
def fitImage(self, value): Functions.TypeCheck(value, type(False), "fitImage", "RenderOptions") self.__fitImage = value if (self.__owner != None): self.__owner._Object__imageChanged = True SetEdited(self)
def clickGroup(self, value): Functions.TypeCheck(value, int, "clickGroup") self.__clickGroup = value
def onScroll(self, value): Functions.TypeCheck( value, [types.FunctionType, type(None)], "onScroll", "Button") TestFuncLen(value, "onScroll", ["self", "int_direction"]) self.__onScroll = value
def top(self, value): Functions.TypeCheck(value, [float, int], "top", "Rect") self.__top = float(value) UpdateRects(self) SetEdited(self)
def onClick(self, value): Functions.TypeCheck( value, [types.FunctionType, type(None)], "onClick", "Button") TestFuncLen(value, "onClick", ["self", "string_mouseButton"]) self.__onClick = value
def onDrag(self, value): Functions.TypeCheck( value, [types.FunctionType, type(None)], "onDrag", "Button") TestFuncLen(value, "onDrag") self.__onDrag = value
def enableDragOff(self, value): Functions.TypeCheck(value, bool, "enableDragOff", "Button") self.__enableDragOff = value
def button(self, value): Functions.TypeCheck(value, [Button, type(None)], "button") self.__button = value
def velocity(self, value): Functions.TypeCheck(value, tuple, "velocity") self.__velocity = value
def font(self, value): Functions.TypeCheck(value, str, "font", "String") self.__font = value self.__rowChanged = True SetEdited(self)
def renderOptions(self, value): self.__edited = True Functions.TypeCheck(value, RenderOptions, "renderOptions") self.__renderOptions = value self._RenderOptions__owner = self TransformImage(self)
def left(self, value): Functions.TypeCheck(value, [float, int], "left", "Rect") self.__left = float(value) UpdateRects(self) SetEdited(self)
def onHoverOn(self, value): Functions.TypeCheck( value, [types.FunctionType, type(None)], "onHoverOn", "Button") TestFuncLen(value, "onHoverOn") self.__onHoverOn = value
def enabled(self, value): self.__edited = True Functions.TypeCheck(value, bool, "enabled") self.__enabled = value
def maxRows(self, value): Functions.TypeCheck(value, int, "maxRows", "String") self.__maxRows = value self.__rowChanged = True
def onHoverOff(self, value): Functions.TypeCheck( value, [types.FunctionType, type(None)], "onHoverOff", "Button") TestFuncLen(value, "onHoverOff", ["self", "string_reason"]) self.__onHoverOff = value
def image(self, value): self.__edited = True Functions.TypeCheck(value, pygame.Surface, "image") self.__image = value #.convert_alpha() self.__transformed = True self.__transformedColor = True