Beispiel #1
0
 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)
Beispiel #2
0
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
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 def fontSize(self, value):
     Functions.TypeCheck(value, [int, float], "fontSize", "String")
     self.__fontSize = value
     self.__rowChanged = True
     SetEdited(self)
Beispiel #6
0
 def text(self, value):
     Functions.TypeCheck(value, str, "text", "String")
     self.__text = value
     self.__rowChanged = True
     SetEdited(self)
Beispiel #7
0
 def addDash(self, value):
     Functions.TypeCheck(value, bool, "addDash", "String")
     self.__addDash = value
     self.__rowChanged = True
Beispiel #8
0
 def alignment(self, value):
     Functions.TypeCheck(value, int, "alignment", "String")
     self.__alignment = value
     self.__imageChanged = True
     SetEdited(self)
Beispiel #9
0
 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)
Beispiel #10
0
 def clickGroup(self, value):
     Functions.TypeCheck(value, int, "clickGroup")
     self.__clickGroup = value
Beispiel #11
0
 def onScroll(self, value):
     Functions.TypeCheck(
         value, [types.FunctionType, type(None)], "onScroll", "Button")
     TestFuncLen(value, "onScroll", ["self", "int_direction"])
     self.__onScroll = value
Beispiel #12
0
 def top(self, value):
     Functions.TypeCheck(value, [float, int], "top", "Rect")
     self.__top = float(value)
     UpdateRects(self)
     SetEdited(self)
Beispiel #13
0
 def onClick(self, value):
     Functions.TypeCheck(
         value, [types.FunctionType, type(None)], "onClick", "Button")
     TestFuncLen(value, "onClick", ["self", "string_mouseButton"])
     self.__onClick = value
Beispiel #14
0
 def onDrag(self, value):
     Functions.TypeCheck(
         value, [types.FunctionType, type(None)], "onDrag", "Button")
     TestFuncLen(value, "onDrag")
     self.__onDrag = value
Beispiel #15
0
 def enableDragOff(self, value):
     Functions.TypeCheck(value, bool, "enableDragOff", "Button")
     self.__enableDragOff = value
Beispiel #16
0
 def button(self, value):
     Functions.TypeCheck(value, [Button, type(None)], "button")
     self.__button = value
Beispiel #17
0
 def velocity(self, value):
     Functions.TypeCheck(value, tuple, "velocity")
     self.__velocity = value
Beispiel #18
0
 def font(self, value):
     Functions.TypeCheck(value, str, "font", "String")
     self.__font = value
     self.__rowChanged = True
     SetEdited(self)
Beispiel #19
0
 def renderOptions(self, value):
     self.__edited = True
     Functions.TypeCheck(value, RenderOptions, "renderOptions")
     self.__renderOptions = value
     self._RenderOptions__owner = self
     TransformImage(self)
Beispiel #20
0
 def left(self, value):
     Functions.TypeCheck(value, [float, int], "left", "Rect")
     self.__left = float(value)
     UpdateRects(self)
     SetEdited(self)
Beispiel #21
0
 def onHoverOn(self, value):
     Functions.TypeCheck(
         value, [types.FunctionType, type(None)], "onHoverOn", "Button")
     TestFuncLen(value, "onHoverOn")
     self.__onHoverOn = value
Beispiel #22
0
 def enabled(self, value):
     self.__edited = True
     Functions.TypeCheck(value, bool, "enabled")
     self.__enabled = value
Beispiel #23
0
 def maxRows(self, value):
     Functions.TypeCheck(value, int, "maxRows", "String")
     self.__maxRows = value
     self.__rowChanged = True
Beispiel #24
0
 def onHoverOff(self, value):
     Functions.TypeCheck(
         value, [types.FunctionType, type(None)], "onHoverOff", "Button")
     TestFuncLen(value, "onHoverOff", ["self", "string_reason"])
     self.__onHoverOff = value
Beispiel #25
0
 def image(self, value):
     self.__edited = True
     Functions.TypeCheck(value, pygame.Surface, "image")
     self.__image = value  #.convert_alpha()
     self.__transformed = True
     self.__transformedColor = True