Functions

generate_qr_code_async (text, requested_size, bg_color, fg_color, format, ecc, cancellable, callback, *user_data)

generate_qr_code_finish (result)

generate_qr_code_sync (text, requested_size, bg_color, fg_color, format, ecc, cancellable)

Details

GnomeQR.generate_qr_code_async(text, requested_size, bg_color, fg_color, format, ecc, cancellable, callback, *user_data)
Parameters:
  • text (str) – The text of which generate the QR code

  • requested_size (int) – The requested size (width and height) in pixels of the QR code. Only square QR codes are supported. If the requested size is smaller than the minimum required size for the QR code, it will be generated with 1 pixel per block.

  • bg_color (GnomeQR.Color or None) – The background color of the code or None to use default (white)

  • fg_color (GnomeQR.Color or None) – The foreground color of the code or None to use default (black)

  • format (GnomeQR.PixelFormat) – The pixel format for the output image data

  • ecc (GnomeQR.EccLevel) – The error correction level

  • cancellable (Gio.Cancellable or None) – A Gio.Cancellable to cancel the operation

  • callback (Gio.AsyncReadyCallback or None) – function to call returning success or failure of the async grabbing

  • user_data (object or None) – the data to pass to callback function

Generates the QrCode asynchronously.

Use GnomeQR.generate_qr_code_finish() to complete it.

GnomeQR.generate_qr_code_finish(result)
Parameters:

result (Gio.AsyncResult) – the Gio.AsyncResult that was provided to the callback

Raises:

GLib.Error

Returns:

The pixel data or None on error

pixel_size_out:

The actual square QR code size (width and height) in pixels. Note that it may not match the requested_size in GnomeQR.generate_qr_code_async().

Return type:

(GLib.Bytes, pixel_size_out: int)

Finish the asynchronous operation started by GnomeQR.generate_qr_code_async() and obtain its result.

GnomeQR.generate_qr_code_sync(text, requested_size, bg_color, fg_color, format, ecc, cancellable)
Parameters:
  • text (str) – the text of which generate the QR code

  • requested_size (int) – The requested size (width and height) in pixels of the QR code. Only square QR codes are supported. If the requested size is smaller than the minimum required size for the QR code, it will be generated with 1 pixel per block.

  • bg_color (GnomeQR.Color or None) – The background color of the code or None to use default (white)

  • fg_color (GnomeQR.Color or None) – The foreground color of the code or None to use default (black)

  • format (GnomeQR.PixelFormat) – The pixel format for the output image data

  • ecc (GnomeQR.EccLevel) – The error correction level

  • cancellable (Gio.Cancellable or None) – A Gio.Cancellable to cancel the operation

Raises:

GLib.Error

Returns:

The pixel data or None on error

pixel_size_out:

The actual square QR code size (width and height) in pixels. Note that it may not match requested_size.

Return type:

(GLib.Bytes, pixel_size_out: int)

Generates the QrCode synchronously.