Skip to main content

A QR code generator written purely in Python with SVG, EPS, PNG and terminal output.

Project description

The pyqrcode module is a QR code generator that is simple to use and written in pure python. The module can automates most of the building process for creating QR codes. Most codes can be created using only two lines of code!

Unlike other generators, all of the helpers can be controlled manually. You are free to set any or all of the properties of your QR code.

QR codes can be saved as SVG, PNG (by using the pypng module), and plain text. They can also be displayed directly in most Linux terminal emulators. PIL is not used to render the image files.

The pyqrcode module attempts to follow the QR code standard as closely as possible. The terminology and the encodings used in pyqrcode come directly from the standard. This module also follows the algorithm laid out in the standard.

Homepage: https://github.com/mnooner256/pyqrcode

Documentation: http://pythonhosted.org/PyQRCode/

Requirements

The pyqrcode module only requires Python 2.7, Python 2.6, or Python 3. You may want to install pypng in order to render PNG files, but it is optional. Note, pypng is a pure python PNG writer which does not require any other libraries.

Installation

Installation is simple. It can be installed from pip using the following command:

$ pip install pyqrcode

or from the terminal:

$ python setup.py install

Usage

The pyqrcode module aims to be as simple to use as possible. Below is a simple example of creating a QR code for a URL. The code is rendered out as an svg file.

>>> import pyqrcode
>>> url = pyqrcode.create('http://uca.edu')
>>> url.svg('uca-url.svg', scale=8)
>>> url.eps('uca-url.eps', scale=2)
>>> print(url.terminal(quiet_zone=1))

The pyqrcode module, while easy to use, is powerful. You can set every property of the QR code. If you install the optional pypng module, you can render the code as a PNG image. Below is a more complex example:

>>> big_code = pyqrcode.create('0987654321', error='L', version=27, mode='binary')
>>> big_code.png('code.png', scale=6, module_color=[0, 0, 0, 128], background=[0xff, 0xff, 0xcc])
>>> big_code.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

PyQRCode-1.1.1.zip (40.8 kB view details)

Uploaded Source

PyQRCode-1.1.1.tar.gz (35.2 kB view details)

Uploaded Source

File details

Details for the file PyQRCode-1.1.1.zip.

File metadata

  • Download URL: PyQRCode-1.1.1.zip
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyQRCode-1.1.1.zip
Algorithm Hash digest
SHA256 765eecf1e0a85c6644f0334e8ba55940cbc333ae4b8991155cfd9d1b9218900f
MD5 e37ca997d679e6f37466dd90982c5306
BLAKE2b-256 6b3bc79d6b822afb3d4314bc61acd45972ca6630ac45bde85fa35a00a6fb00c7

See more details on using hashes here.

File details

Details for the file PyQRCode-1.1.1.tar.gz.

File metadata

  • Download URL: PyQRCode-1.1.1.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyQRCode-1.1.1.tar.gz
Algorithm Hash digest
SHA256 4e42e18a7c2c907bb9130e90d9d30735b9c52ea494e2a4392a5a0b8f5c570a45
MD5 24b949050b001d9fa98cc66ea1a56847
BLAKE2b-256 c945473ed8fdca20ff18268623721d4994d20d371f0f2d7cd62e22560919c5f4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page