Advertisement
steve-shambles-2109

218-Create QR Codes

Feb 29th, 2020
3,665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. """Code snippets vol-44-snip-218
  2. 218-Create QR Codes
  3.  
  4. requires:
  5. pip install pyqrcode
  6.  
  7. original source:
  8. https://www.geeksforgeeks.org/python-generate-qr-code-using-pyqrcode-module/
  9. """
  10. import webbrowser
  11. import pyqrcode
  12.  
  13. # String to encode. You can use a lot of links or lots of text if you want.
  14. qr_str = 'stevepython.wordpress.com'
  15.  
  16. # Generate QR code.
  17. gen_code = pyqrcode.create(qr_str)
  18.  
  19. # Create and save the qr image.
  20. # You may want to experiment with the scale variable
  21. # to get your desired qr image size.
  22. gen_code.svg('my_qr.svg', scale=8)
  23.  
  24. # Display the image in default app or web browser.
  25. webbrowser.open('my_qr.svg')
  26.  
  27. """
  28. The related Qr code article to this code, Feb 2020.
  29. https://stevepython.wordpress.com/2020/02/27/how-to-create-qr-codes
  30. ---
  31. Download 240+ no nonsense python code snippets:
  32. https://wp.me/Pa5TU8-1yg
  33. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement