Before starting the project we need to install some necessary modules: pyqrcode and pypng.
Open your cmd and type these commands separately.
pip install pyqrcode
pip install pypng
Now lets create a variable named with text. Then assign it the text we need to encrypt.
text='I Love Knowcubs'
Create a variable named with qrcode and create qrcode by calling 'create' method of pyqrcode module.
qrcode=pyqrcode.create(text)
Now let’s make it in a png file.
qrcode.png(‘qrcode.png’,scale=15)
Here we take variable qrcode and convert it into png file, pass the name of the file as a string and give a value for the scale.
Let’s open QR Code we have two ways to open it:
1. With the help of OS module
Os.system(‘qrcode.png’)
2. Go to the folder where the program is and open .png file form there.
Comments