How to use the guizero.utilities.convert_color function in guizero

To help you get started, we’ve selected a few guizero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lawsie / guizero / guizero / Drawing.py View on Github external
The color of the shape. Defaults to `"black"`.

        :param int outline:
            `0` or `False` is no outline. `True` or value > 1 sets an outline. Defaults to `False`.

        :param str outline_color:
            The color of the outline. Defaults to `"black"`.

        :return:
            The id of the shape.
        """
        return self.tk.create_oval(
            x1, y1, x2, y2, 
            outline = utils.convert_color(outline_color) if outline else "",
            width = int(outline),
            fill = "" if color is None else utils.convert_color(color)
            )
github lawsie / guizero / guizero / Drawing.py View on Github external
:param str color:
            The color of the shape. Defaults to `"black"`.

        :param int outline:
            `0` or `False` is no outline. `True` or value > 1 sets an outline. Defaults to `False`.

        :param str outline_color:
            The color of the outline. Defaults to `"black"`.

        :return:
            The id of the shape.
        """
        return self.tk.create_rectangle(
            x1, y1, x2, y2, 
            outline = utils.convert_color(outline_color) if outline else "",
            width = int(outline),
            fill = "" if color is None else utils.convert_color(color)
            )
github lawsie / guizero / guizero / base.py View on Github external
def text_color(self, value):
        self._text_color = utils.convert_color(value)
        # cascade text color to child widgets
        for child in self.children:
            if isinstance(child, (Container, TextWidget)):
                child.text_color = self.text_color
github lawsie / guizero / guizero / Waffle.py View on Github external
def color(self, value):
        old_color = self._color
        self._color = utils.convert_color(value)
        for x in range(self._width):
            for y in range(self._height):
                if self._waffle_pixels[x,y].color == old_color:
                    self._waffle_pixels[x,y].color = self._color
github lawsie / guizero / guizero / Drawing.py View on Github external
The color of the shape. Defaults to `"black"`.

        :param int outline:
            `0` or `False` is no outline. `True` or value > 1 sets an outline. Defaults to `False`.

        :param str outline_color:
            The color of the outline. Defaults to `"black"`.

        :return:
            The id of the shape.
        """
        return self.tk.create_polygon(
            *coords, 
            outline = utils.convert_color(outline_color) if outline else "",
            width = int(outline),
            fill = "" if color is None else utils.convert_color(color)
            )
github lawsie / guizero / guizero / Drawing.py View on Github external
default font size.

        :param int max_width:
            Maximum line length. Lines longer than this value are wrapped. 
            Default is `None` (no wrapping).
        """
        # create the font
        if size is None:
            f = Font(self.tk, family=font)
        else:
            f = Font(self.tk, family=font, size=size)
        
        return self.tk.create_text(
            x, y, 
            text=text,
            fill = "" if color is None else utils.convert_color(color),
            font=f,
            width=max_width,
            anchor="nw")
github lawsie / guizero / guizero / Box.py View on Github external
def set_border(self, thickness, color="black"):
        """
        Sets the border thickness and color.

        :param int thickness:
            The thickenss of the border.

        :param str color:
            The color of the border.
        """
        self._set_tk_config("highlightthickness", thickness)
        self._set_tk_config("highlightbackground", utils.convert_color(color))
github lawsie / guizero / guizero / Waffle.py View on Github external
def color(self, value):
        self._color = utils.convert_color(value)
        self._canvas.itemconfig(self._drawn_object, fill=self._color)