-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqrcode.py
More file actions
68 lines (56 loc) · 1.86 KB
/
Copy pathqrcode.py
File metadata and controls
68 lines (56 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
import sys
import traceback
import pyqrcode
import png
print(" _ ")
print("__ _____| | ___ ___ _ __ ___ ___ ")
print("\ \ /\ / / _ \ |/ __/ _ \| '_ \` _ \ / _ \ ")
print(" \ V V / __/ | (_| (_) | | | | | | __/")
print(" \_/\_/ \___|_|\___\___/|_| |_| |_|\___|")
print(" ")
def url():
s = input("Digite a url para gerar o QRCODE: ")
if s is not None:
print(f'Você inseriu essa url:{s}, deseja alterar?\n ')
choice = input('S ou N: ')
if choice == "s":
s = input("Digite a url para gerar o QRCODE: ")
print('Url inserida com sucesso\n')
return s
if choice == "n":
print('Url inserida com sucesso\n')
return s
def nome():
n = input("Digite o nome do arquivo de saída: ")
if n is not None:
print('Nome definido com sucesso!\n')
return n
else:
print('Você precisa definir um nome válido!\n')
n = input("Digite o nome do arquivo de saída: ")
print('Nome definido com sucesso!\n')
return n
def escala():
es = input("Digite o tamanho do QRCode (Padrão: 8): ")
if es is not None:
print('Tamanho definido com sucesso!\n')
return es
else:
print('Você precisa definir um tamanho válido!\n')
es = input("Digite o tamanho do QRCode (Padrão: 8): ")
print('Tamanho definido com sucesso!\n')
return es
def criacao():
link = url()
qr = pyqrcode.create(link)
qr.png(nome() + ".png", scale=escala())
return print('QRCode criado com sucesso!')
if __name__ == '__main__':
try:
criacao()
except BaseException:
print(sys.exc_info()[0])
print(traceback.format_exc())
print("Press Enter to continue ...")
input()