Advertisement
renix1

myqr

Oct 3rd, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. # coding:utf-8
  2. from MyQR import myqr
  3. from appJar import gui
  4. import os
  5.  
  6.  
  7.  
  8. def create_qrcode():
  9.     text = app.getEntry("Texto").encode("utf-8").decode("ascii", "ignore")
  10.     picture_path = app.getEntry("f1")
  11.     if not picture_path:
  12.         colorf = False
  13.     else:
  14.         colorf = True
  15.     version, level, qr_name = myqr.run(text,
  16.                                                                         version=1,
  17.                                                                         level='H',
  18.                                                                         picture=picture_path,
  19.                                                                         colorized=colorf,
  20.                                                                         save_name="qr_pronto.gif",
  21.                                                                         save_dir=os.getcwd())
  22.     app.setImage("qrcode", "qr_pronto.gif")
  23.     os.remove("qr_pronto.gif")
  24.  
  25.  
  26. app = gui()
  27. app.title = "Gerar QR Code"
  28. app.addEntry("Texto")
  29. app.addFileEntry("f1")
  30. app.addImage("qrcode", "none.png")
  31. app.addButton("Gerar", create_qrcode)
  32.  
  33.  
  34.  
  35. app.go()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement