Пример #1
0
    def text(self, txt):
        """text: The text to display."""
        if type(txt) != str:
            raise TypeError('Error: txt=' + str(txt) + ' must be a string.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'text',
                                         to_lua(txt)))
Пример #2
0
    def border_width(self, bw):
        """border_width: The border width to draw around."""
        if type(bw) != int and type(bw) != float:
            raise TypeError('Error: bw=' + str(bw) +
                            ' must be a int or float.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'border_width',
                                         to_lua(bw)))
Пример #3
0
    def align(self, a):
        """align: Text alignment, left, center or right."""
        if type(a) != str:
            raise TypeError("Error: a=" + str(a) + " must be a string.")

        if a != "left" and a != "center" and a != "right":
            raise ValueError("Error: align can be either left, center or right.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "align", to_lua(a)))
Пример #4
0
    def bg(self, bk):
        """bk: Background color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bk) != str:
            raise TypeError('Error: bk=' + str(bk) + ' must be a string.')

        if bk == 'trasparent':
            bk = '#00000000'
        execute("{0}.{1} = '{2}'".format(self.widget_name, 'bg', to_lua(bk)))
Пример #5
0
    def border_color(self, bc):
        """border_color: The border color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bc) != str:
            raise TypeError("Error: bc=" + str(bc) + " must be a string.")

        if bc == "trasparent":
            bc = "#00000000"
        execute("{0}.{1} = '{2}'".format(self.widget_name, "border_color", to_lua(bc)))
Пример #6
0
    def bg(self, bk):
        """bk: Background color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bk) != str:
            raise TypeError("Error: bk=" + str(bk) + " must be a string.")

        if bk == "trasparent":
            bk = "#00000000"
        execute("{0}.{1} = '{2}'".format(self.widget_name, "bg", to_lua(bk)))
Пример #7
0
    def align(self, a):
        """align: Text alignment, left, center or right."""
        if type(a) != str:
            raise TypeError('Error: a=' + str(a) + ' must be a string.')

        if a != 'left' and a != 'center' and a != 'right':
            raise ValueError(
                'Error: align can be either left, center or right.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'align', to_lua(a)))
Пример #8
0
    def set_height(self, height):
        """Set the graph height.
            Parameters:
            height: The height to set.
        """
        if type(height) != int and type(height) != float:
            raise TypeError('Error: height=' + str(height) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_height',
                                      to_lua(height)))
Пример #9
0
    def border_color(self, bc):
        """border_color: The border color.
           Put 'trasparent' for a trasparent color.
        """
        if type(bc) != str:
            raise TypeError('Error: bc=' + str(bc) + ' must be a string.')

        if bc == 'trasparent':
            bc = '#00000000'
        execute("{0}.{1} = '{2}'".format(self.widget_name, 'border_color',
                                         to_lua(bc)))
Пример #10
0
    def set_scale(self, scale):
        """
            Set the graph to automatically scale its values. 
            Default is false.
            Parameters:
            scale: A boolean value
        """
        if type(scale) != bool:
            raise TypeError('Error: scale=' + str(scale) + ' must be a bool.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_scale',
                                      to_lua(scale)))
Пример #11
0
    def set_stack(self, stack):
        """
            Set the graph to draw stacks. 
            Default is false.
            Parameters:
            stack: A boolean value.
        """
        if type(stack) != bool:
            raise TypeError('Error: stack=' + str(stack) + ' must be a bool.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_stack',
                                      to_lua(stack)))
Пример #12
0
    def set_stack_colors(self, stack_colors):
        """
            Set the graph stacking colors. Order matters.
            Parameters:
            stack_colors: A table with stacking colors.
        """
        if type(stack_colors) != dict:
            raise TypeError('Error: stack_colors=' + str(stack_colors) +
                            ' must be a dict.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_stack_colors',
                                      to_lua(stack_colors)))
Пример #13
0
    def set_width(self, width):
        """
            Set the graph width.
            Parameters:
            width: The width to set.
        """
        if type(width) != int and type(width) != float:
            raise TypeError('Error: width=' + str(width) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_width',
                                      to_lua(width)))
Пример #14
0
    def set_color(self, color):
        """
            Set the graph foreground color.
            Parameters:
            color: The graph color.
        """
        if type(color) != str:
            raise TypeError('Error: color=' + str(color) +
                            ' must be a string.')

        execute("{0}:{1}('{2}')".format(self.widget_name, 'set_color',
                                        to_lua(color)))
Пример #15
0
    def set_gradient_angle(self, gradient_angle):
        """
            Set the graph foreground colors gradient angle.
            Default is 270 degrees (horizontal).
            Parameters:
            gradient_angle: Angle of gradient in degrees.
        """
        if type(gradient_angle) != int and type(gradient_angle) != float:
            raise TypeError('Error: gradient_angle=' + str(gradient_angle) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_gradient_angle',
                                      to_lua(gradient_angle)))
Пример #16
0
    def set_border_color(self, color):
        """
            Set the graph border color. 
            If the value is nil, no border will be drawn.
            Parameters:
            color: The border color to set.
        """
        if type(color) != str:
            raise TypeError('Error: color=' + str(color) +
                            ' must be a string.')

        execute("{0}:{1}('{2}')".format(self.widget_name, 'set_border_color',
                                        to_lua(color)))
Пример #17
0
    def set_max_value(self, value):
        """
            Set the maximum value the graph should handle. 
            If "scale" is also set, the graph never scales up below this value, 
            but it automatically scales down to make all data fit.
            Parameters:
            value: The value.
        """
        if type(value) != int and type(value) != float:
            raise TypeError('Error: value=' + str(value) +
                            ' must be a int or float.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_max_value',
                                      to_lua(value)))
Пример #18
0
    def set_gradient_colors(self, gradient_colors):
        """
            Set the graph foreground color as a gradient.
            Parameters:
            gradient_colors: A table with gradients colors. 
            The distance between each color can also be specified.
            Example: { "red", "blue" } or { "red", "green", "blue", blue = 10 } 
            to specify blue distance from other colors.
        """
        if type(gradient_colors) != set:
            raise TypeError('Error: gradient_colors=' + str(gradient_colors) +
                            ' must be a dict.')

        execute("{0}:{1}({2})".format(self.widget_name, 'set_gradient_colors',
                                      to_lua(gradient_colors)))
Пример #19
0
    def add_value(self, value, group=None):
        """
            Add a value to the graph
            Parameters: 
            value: The value between 0 and 1.
            group: The stack color group index.

        """
        if type(value) != float and type(value) != int:
            raise TypeError('Error: value=' + str(value) +
                            ' must be a float or int.')

        if value < 0 or value > 1:
            raise ValueError('Error: value=' + value +
                             '. It must be between 0 and 1.')

        execute("{0}:{1}({2})".format(self.widget_name, 'add_value',
                                      to_lua(value)))
Пример #20
0
    def visible(self, b):
        if type(b) != bool:
            raise TypeError("Error: b=" + str(b) + " must be a bool.")

        execute("{0}.{1} = {2}".format(self.widget_name, "visible", to_lua(b)))
Пример #21
0
    def border_width(self, bw):
        """border_width: The border width to draw around."""
        if type(bw) != int and type(bw) != float:
            raise TypeError("Error: bw=" + str(bw) + " must be a int or float.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "border_width", to_lua(bw)))
Пример #22
0
    def width(self, w):
        """width(int or float): The width of the textbox. Set to 0 for auto."""
        if type(w) != int and type(w) != float:
            raise TypeError('Error: w=' + str(w) + ' must be a int or float.')

        execute("{0}.{1} = '{2}'".format(self.widget_name, 'width', to_lua(w)))
Пример #23
0
    def text(self, txt):
        """text: The text to display."""
        if type(txt) != str:
            raise TypeError("Error: txt=" + str(txt) + " must be a string.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "text", to_lua(txt)))
Пример #24
0
    def width(self, w):
        """width(int or float): The width of the textbox. Set to 0 for auto."""
        if type(w) != int and type(w) != float:
            raise TypeError("Error: w=" + str(w) + " must be a int or float.")

        execute("{0}.{1} = '{2}'".format(self.widget_name, "width", to_lua(w)))
Пример #25
0
    def visible(self, b):
        if type(b) != bool:
            raise TypeError('Error: b=' + str(b) + ' must be a bool.')

        execute("{0}.{1} = {2}".format(self.widget_name, 'visible', to_lua(b)))