/+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: 2007-12-13 22:35:59 UTC
  • Revision ID: git-v1:a7ad1afe3f08b7de8b3a3cbdc7165d4f88ddbe92
version bump, added BadContentTypeException, added a few examples, added COPYING licence, code is more PEP8 friendly, download() checks for content type and raises on bad http codes, add_data returns the index of the dataset, Line doesn't allow being an instance.

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