Beispiel #1
0
 def get_png_size(self, scale):
     """This is method helps users determine what *scale* to use when
     creating a PNG of this QR code. It is meant mostly to be used in the
     console to help the user determine the pixel size of the code
     using various scales.
     
     This method will return an integer representing the width and height of
     the QR code in pixels, as if it was drawn using the given *scale*.
     Because QR codes are square, the number represents both dimensions.
     
     Example:
         >>> code = pyqrcode.QRCode("I don't like spam!")
         >>> print(code.get_png_size(1))
         31
         >>> print(code.get_png_size(5))
         155
     """
     return builder._get_png_size(self.version, scale)
Beispiel #2
0
 def get_png_size(self, scale):
     """This is method helps users determine what *scale* to use when
     creating a PNG of this QR code. It is meant mostly to be used in the
     console to help the user determine the pixel size of the code
     using various scales.
     
     This method will return an integer representing the width and height of
     the QR code in pixels, as if it was drawn using the given *scale*.
     Because QR codes are square, the number represents both dimensions.
     
     Example:
         >>> code = pyqrcode.QRCode("I don't like spam!")
         >>> print(code.get_png_size(1))
         31
         >>> print(code.get_png_size(5))
         155
     """
     return builder._get_png_size(self.version, scale)
Beispiel #3
0
    def get_png_size(self, scale=1, quiet_zone=4):
        """这个实例方法是帮助用户确定使用多少 *scale* 标量用的。
        当建立二维码的 PNG 文件时,标量用在终端里可以帮助用户确定
        二维码的像素尺寸,使用不同的标量值,二维码像素尺寸也不一样。

        这个方法会返回一个整数,表示二维码像素的宽和高。
        如果使用给出 *scale* 标量来绘制二维码,你就知道相应的像素大小是多少。
        由于二维码是正方形,数字表示了空间的宽和高。

        其中 *quiet_zone* 参数是设置二维码周围的无噪点区域有多宽。
        根据二维码标准,无噪点区域应该是4个数据块宽。把这个作为可设置的,
        是因为这种无噪点区域的宽在许多应用程序中是不需要的,因为很少会打印二维码。

        Example:
            >>> code = pyqrcode.QRCode("I don't like spam!")
            >>> print(code.get_png_size(1))
            31
            >>> print(code.get_png_size(5))
            155
        """
        return builder._get_png_size(self.version, scale, quiet_zone)
Beispiel #4
0
    def get_png_size(self, scale=1, quiet_zone=4):
        """This is method helps users determine what *scale* to use when
        creating a PNG of this QR code. It is meant mostly to be used in the
        console to help the user determine the pixel size of the code
        using various scales.

        This method will return an integer representing the width and height of
        the QR code in pixels, as if it was drawn using the given *scale*.
        Because QR codes are square, the number represents both the width
        and height dimensions.

        The *quiet_zone* parameter sets how wide the quiet zone around the code
        should be. According to the standard this should be 4 modules. It is
        left settable because such a wide quiet zone is unnecessary in many
        applications where the QR code is not being printed.

        Example:
            >>> code = pyqrcode.QRCode("I don't like spam!")
            >>> print(code.get_png_size(1))
            31
            >>> print(code.get_png_size(5))
            155
        """
        return builder._get_png_size(self.version, scale, quiet_zone)
Beispiel #5
0
    def get_png_size(self, scale=1, quiet_zone=4):
        """This is method helps users determine what *scale* to use when
        creating a PNG of this QR code. It is meant mostly to be used in the
        console to help the user determine the pixel size of the code
        using various scales.

        This method will return an integer representing the width and height of
        the QR code in pixels, as if it was drawn using the given *scale*.
        Because QR codes are square, the number represents both the width
        and height dimensions.

        The *quiet_zone* parameter sets how wide the quiet zone around the code
        should be. According to the standard this should be 4 modules. It is
        left settable because such a wide quiet zone is unnecessary in many
        applications where the QR code is not being printed.

        Example:
            >>> code = pyqrcode.QRCode("I don't like spam!")
            >>> print(code.get_png_size(1))
            31
            >>> print(code.get_png_size(5))
            155
        """
        return builder._get_png_size(self.version, scale, quiet_zone)