Dynamic QR code
Okay , The next step is to see how to use two lines of code to generate your own QR code .
stay Python To generate a two-dimensional code, you need to call MYQR Third party Library , This library can be said to be specially tailored for two-dimensional code , Call the run Function can directly generate the desired two-dimensional code ,
.
Ordinary QR code
========================================================================
To generate a normal QR code, you only need to run Middle feeding words The QR code to be generated can be passed in , For example, we will 360 The browser's main interface generates a QR code : The website is :“https://hao.360.com/”.
Run the following code :
from MyQR import myqr
myqr.run(words='https://hao.360.com/')
Be accomplished , At this time, we can find the generated in the default folder of the program .png Format of the QR code .
.
Art QR code with pictures
============================================================================
When generating art QR code with pictures , We need to add... To the original program picture Parameters , The background image of the QR code we want to set , Use colorized=True Parameter setting picture background color , If you don't set , The default image is black and white background .
We can also use save_name Parameter name the QR code .
It is worth noting that : To avoid image format errors , The format of the named QR code needs to be the same as that of the background image .
For example, we use pictures “mtsc_body15.png” Generate a QR code for the background . The generated QR code is named “qr1.png”
The code is as follows :
from MyQR import myqr
myqr.run(words='https://hao.360.com/',
picture='Sources/mtsc_body15.png',
save_name='qr1.png',
colorized=True)
The effect of the generated QR code is as follows :
.
Dynamic QR code
========================================================================
In fact, dynamic two-dimensional code is similar to art two-dimensional code with pictures , We just need to change the background image to GIF chart , Change the format of the generated QR code image to GIF that will do . Dressed in beautiful new clothes GIF Here's an example :
The code is as follows :
from MyQR import myqr
myqr.run(words='https://hao.360.com/',
# Last
I also have a collection of Java Interview core knowledge to deal with the interview , Take this opportunity to give it to my readers for free :
** Catalog :**
![ Two sides of ant gold clothes ( Intersection ), Have to take offer,Java The rank of the post is Ali P6](https://img-blog.csdnimg.cn/img_convert/a74c5b32d3a9f60e5a4789fd1365d2a7.png)
Java Interview core knowledge points
** Altogether 30 Topics , Enough readers for the interview , It also saves time for friends to search for information everywhere and organize themselves !**
![ Two sides of ant gold clothes ( Intersection ), Have to take offer,Java The rank of the post is Ali P6](https://img-blog.csdnimg.cn/img_convert/8cdb85567f056190c8077280f8e35ab9.png)
Java Interview core knowledge points
mChzXRC-1628508847664)]
Java Interview core knowledge points
** Altogether 30 Topics , Enough readers for the interview , It also saves time for friends to search for information everywhere and organize themselves !**
[ Outside the chain picture transfer in ...(img-y8cSjC5X-1628508847667)]
Java Interview core knowledge points
** How to get the information : After likes 【[ Stamp interview information ](https://gitee.com/vip204888/java-p7)】 You can get it for free !**