QR Code Generator with Python(Beginner) in 3 lines

 

                                                                           

Today we are doing our first project in this series that is a 'QR Code Generator' using python. I know you all are very excited to do this.  But before we jump into project let me give a brief idea on what is a 'QR Code'.

 

QR Code  

A QR Code (Quick Response Code ) is a machine readable code which can contain Urls, images etc, When we scan these codes we are taken to the attached address.  But in nowadays these codes are used almost everywhere it is used in tracking of products,  for payment activities, for downloading applications.  This is some basic knowledge about these QR Codes if you want to know more about these codes just visit Qr Code Details. Below  you can see an example of how a Qr Code looks.

 


Project

    step 1 : To make qr codes we need a module named 'qrcode' . So first you need to install that module. To install that just type 'pip install qrcode' in the terminal

 

 

    step2:  Import the qr code module to use it

 

 

   step3: Use the make function to create and pass the text you want as the content as argument and assign it  to variable(mycode = variable) .Syntax :   qrcode.function("Hello Guys")  

     


step4: Now the final step is to save it as a image, for that use the command mycodesave('code.png')
                note: mycode is the name of the variable


 

Final Code:


 

 Output:


 This just a very simple qr code using the qrcode module. If you want to get more control of it by adjusting the border width, foreground and background color etc. all that are possible with this module. If you want a advanced version of this please comment down

 

Comments