bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/pygooglechart-py3k
49
by gak
- Added QR codes example |
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 |