/+junk/pygooglechart-py3k

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/pygooglechart-py3k

« back to all changes in this revision

Viewing changes to examples/qrcodes.py

  • Committer: gak
  • Date: 2008-08-25 09:06:23 UTC
  • Revision ID: git-v1:9facba979178a3471204a39064094bff5c24d22c
 - Added QR codes example

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import os
 
4
import sys
 
5
import math
 
6
 
 
7
ROOT = os.path.dirname(os.path.abspath(__file__))
 
8
sys.path.insert(0, os.path.join(ROOT, '..'))
 
9
 
 
10
from pygooglechart import QRChart
 
11
 
 
12
import settings
 
13
import helper
 
14
 
 
15
def hello():
 
16
 
 
17
    # Create a 250x250 QR chart
 
18
    chart = QRChart(250, 250)
 
19
 
 
20
    # Add the text
 
21
    chart.add_data('Hello, World!')
 
22
 
 
23
    # "Level H" error correction with a 0 pixel margin
 
24
    chart.set_ec('H', 0)
 
25
 
 
26
    # Download
 
27
    chart.download('qr-hello.png')
 
28
 
 
29
def main():
 
30
    hello()
 
31
 
 
32
if __name__ == '__main__':
 
33
    main()
 
34