Skip to content

Instantly share code, notes, and snippets.

@maluta
Last active January 1, 2016 08:28
Show Gist options
  • Save maluta/8118060 to your computer and use it in GitHub Desktop.
Save maluta/8118060 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
"""
This is a game idea [what about for Christmas night] using QR-code.
(1) First I've generated several codes (each one with a different value),
in my case I use money (values on Brazilian Real) and at the party
(2) We randomly assign one to each participant
(3) They need scan the code to get the prize
It's interesting because probably kids will know what to do before mostly adults,
so they will teach your relatives ans friends. This game can be more interesting if you
associate with a quiz (each qr-code enables an enigma to next step until the big prize).
The script below just generate the code for you:
$ python xmas-game.py
and it's easy to figure out what to change to personalize
Leave your computer and enjoy with your family =)
Happy Christmas
Tiago Maluta (@maluta)
"""
import qrcode # install ==> https://pypi.python.org/pypi/qrcode
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
values = ["50"] + ["20"] + ["10"] + ["5"] + ["2"]
for v in values:
qr.add_data('Happy Christmas, this worth US$%s,00' % v)
qr.make(fit=True)
img = qr.make_image()
img.save("%s.png" % v)
qr.clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment