-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQRcodegenerator.py
More file actions
54 lines (50 loc) · 2.03 KB
/
QRcodegenerator.py
File metadata and controls
54 lines (50 loc) · 2.03 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
#Importing the random and qrcode modules
import random
import qrcode
####Made by Janesh Kapoor(2021466) Vidur Goel(2021364) Yajat Gupta (2021366)####
print("-----------------Welcome to CodeQR-----------------")
#Implementing Classes
class QR:
def __init__(self,store):
self.store = store
def default(self):
#Using default settings
makeQR = qrcode.make(self.store)
makeQR.save("QRcode.png")
def custom(self,bsize,brdr,fcolor,bcolor):
#Using Custom settings
features = qrcode.QRCode(version=1,box_size=bsize,border=brdr)
features.add_data(self.store)
makeQR = features.make_image(fill_color=fcolor,back_color=bcolor)
makeQR.save("QRcode.png")
def authenticate():
#Creating Authenticator system
r = random.randrange(1000,10000)
makeQR = qrcode.make(str(r))
makeQR.save("QRcode.png")
io = input("Enter the four digit code recieved : ")
if (io == str(r)):
print("User verified successfully!!!")
else:
print("Oops!!! Wrong code")
print("Enter choice 1 for QR code with default settings")
print("Enter Choice 2 for QR code with custom settings")
print("Enter choice 3 for Authenticating QR code")
choice = int(input("Enter choice : "))
if (choice == 1):
stringlink = input("Enter the string/link to be encoded in your QR code : ")
QRcaller = QR(stringlink)
QRcaller.default()
print("!!!Successfully Created QR Code!!!")
elif(choice == 2):
stringlink = input("Enter the string/link to be encoded in your QR code : ")
bsize = int(input("Enter size of the QR box : "))
brdr = int(input("Enter border value : "))
fcolor = input("Enter fill color of QR Code : ")
bcolor = input("Enter back color of QR Code : ")
QRcaller = QR(stringlink)
QRcaller.custom(bsize,brdr,fcolor,bcolor)
print("!!!Successfully Created QR Code!!!")
elif(choice == 3):
QR.authenticate()
print("--------------Thanks for using CodeQR--------------")