How to use the guizero.Waffle.WafflePixel 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 / Waffle.py View on Github external
curry = self._pad

        for x in range(self._width):
            for y in range(self._height):
                if (x,y) in self._waffle_pixels.keys():
                    # if pixel already exist, reuse it and update the values
                    old_pixel = self._waffle_pixels[(x,y)]
                    new_waffle_pixels[x,y] = WafflePixel(
                        x, y,
                        self._canvas, currx, curry,
                        self._pixel_size,
                        old_pixel.dotty,
                        old_pixel.color)
                else:
                    # create a new celpixell
                    new_waffle_pixels[x,y] = WafflePixel(
                        x, y,
                        self._canvas, currx, curry,
                        self._pixel_size,
                        self._dotty,
                        self._color)

                curry += self._pixel_size + self._pad

            currx += self._pixel_size + self._pad
            curry = self._pad

        self._waffle_pixels = new_waffle_pixels
github lawsie / guizero / guizero / Waffle.py View on Github external
def _size_waffle(self):
        # create new pixels
        new_waffle_pixels = {}
        currx = self._pad
        curry = self._pad

        for x in range(self._width):
            for y in range(self._height):
                if (x,y) in self._waffle_pixels.keys():
                    # if pixel already exist, reuse it and update the values
                    old_pixel = self._waffle_pixels[(x,y)]
                    new_waffle_pixels[x,y] = WafflePixel(
                        x, y,
                        self._canvas, currx, curry,
                        self._pixel_size,
                        old_pixel.dotty,
                        old_pixel.color)
                else:
                    # create a new celpixell
                    new_waffle_pixels[x,y] = WafflePixel(
                        x, y,
                        self._canvas, currx, curry,
                        self._pixel_size,
                        self._dotty,
                        self._color)

                curry += self._pixel_size + self._pad