QR Code Generator Application in Python Using Kivy Module - Beginner's Python Project For Students

Here is the Complete Code For the QR Code Generator Application in Python Using Kivy Module - Beginner's Python Project For Students. ( Download Link of Code Given at the End )

 --- Click on Me to Go to Download Section ---

Qr Code

INTRODUCTION :

The QR code generator is software that stores data into QR code (for example text or website address). This QR Code Generator Application is basically written in Python by using the below mention modules: 

  • kivy                  // $pip install kivy 
  • kivymd             // $pip install kivymd
  • qrcode             // $pip install qrcode
  • plyer                // $pip install plyer

 
NOTE: Please Install these above-mentioned modules before executing the Program.



In this Program, Kivy / Kivymd modules of python are basically used to design an attractive Graphical User Interface for the better experience of the user along with this qrcode is predefined module use to generate QR Code and plyer is basically used to display notifications on the screen.


QR Code Generator Application in Python    QR Code Generator Application in Python     QR Code Generator Application in Python     QR Code Generator Application in Python


This Application can run Windows, macOS, Linux, and Android Devices. For Android, we have to build this application using Google's Colab or by any Linux system but for windows, macOS, and Linux Os it will work by just having a python interpreter.


PYTHON PROGRAM :

from kivymd.app import MDApp

from kivy.uix.screenmanager import ScreenManager
from kivy.lang import Builder
from kivy.core.window import Window
import qrcode
import plyer
Window.size=405,720

class Function(ScreenManager):
    def generate_qr_code(self,root):
        if self.ids.link_text.text != '' and self.ids.image_name.text != '':
            name=str(self.ids.image_name.text)
            code=qrcode.QRCode(version=1.0box_size=15border=4)
            code.add_data(self.ids.link_text.text)
            code.make(fit=True)
            img=code.make_image(fill = 'Black',back_color='White')
            img.save(f"{name}.png")
            #img.save(f"{path}/{name}.png")
            plyer.notification.notify(
                title = 'QR Code Generator',message="QR Code Generated"
            ) 
            self.ids.img_.source=f"{name}.png"
            root.current="image"
        else:
            plyer.notification.notify(
                title = 'QR Code Generator',message="Input Field is Empty"
            )
    
    def make_another(self,root):
        self.ids.link_text.text = ''
        self.ids.image_name.text = ''
        root.current="first"
        

class Main(MDApp):
    Builder.load_file('files/layout.kv')
    def build(self):
        self.title = 'QR Code Generator/Scanner'
        return Function()

Main().run()


#---MADE BY :  Coding PLEX ---
#---Instagram : @codingplex_ and @codingmemes404
#---Youtube : Coding PLEX
#---https://coding-plex.blogspot.com---

 <Function>:

Screen:

name:'a'

MDToolbar:

title : 'HOME - QR Code'

font_style: 'H5'

pos_hint:{"top":1}

specific_text_color:1,1,1,1

elevation:8

BoxLayout:

size_hint_y:.35

pos_hint:{'center_y':.65}

padding:10

Image:

id:img_

source: 'files/home.png'

MDRectangleFlatButton:

text:'Generate QR Code'

icon: 'cloud-search'

on_release: root.current="first"

pos_hint:{'center_x':.5,'center_y':.35}

MDRectangleFlatButton:

text:'About'

icon: 'cloud-search'

on_release: root.current="c"

pos_hint:{'center_x':.5,'center_y':.25}

MDLabel:

text:"Made in Python"

font_style:'H6'

pos_hint:{'center_y':.06}

halign:'center'

BoxLayout:

size_hint_y:.06

padding: "10dp"

pos_hint:{'center_y':.03}

MDTextField:

hint_text: ""

multiline:"false"

icon_right_color: app.theme_cls.primary_color

readonly : "True"

color_mode: 'custom'

helper_text_mode: "on_focus"

icon_right: 'language-python'



Screen:

name: 'first'

MDToolbar:

title : 'QR Code Generator'

font_style: 'H5'

pos_hint:{"top":1}

specific_text_color:1,1,1,1

elevation:8

BoxLayout:

size_hint_y:.1

padding: "10dp"

pos_hint:{'center_y':.8}

MDTextField:

id:image_name

hint_text:'Enter Your Image Name Here'

icon_right: 'keyboard'

BoxLayout:

size_hint_y:.1

padding: "10dp"

pos_hint:{'center_y':.7}

MDTextField:

id:link_text

hint_text:'Enter Your DATA / URL to Generate QR Code'

icon_right: 'link'

MDRectangleFlatButton:

text:'Generate'

on_release: root.generate_qr_code(root)

pos_hint:{'center_x':.5,'center_y':.6}

MDRectangleFlatButton:

text:'Back'

on_release: root.current="a"

pos_hint:{'center_x':.5,'center_y':.1}

Screen:

name:'image'

BoxLayout:

size_hint_y:.6

pos_hint:{'center_y':.56}

padding:10

Image:

id:img_

MDLabel:

text:"QR Code"

font_style:'H4'

pos_hint:{'center_y':.9}

halign:'center'

MDRectangleFlatButton:

text:'Make Another'

on_release: root.make_another(root)

pos_hint:{'center_x':.5,'center_y':.1}

Screen:

name:'b'

MDLabel:

text:"Coming Soon"

font_style:'H4'

pos_hint:{'center_y':.55}

halign:'center'

MDRectangleFlatButton:

text:'Back'

on_release: root.current="a"

pos_hint:{'center_x':.5,'center_y':.1}

Screen:

name:'c'

MDToolbar:

title : 'About'

font_style: 'H5'

pos_hint:{"top":1}

specific_text_color:1,1,1,1

elevation:8

BoxLayout:

size_hint_y:.3

pos_hint:{'center_y':.65}

padding:10

Image:

id:'me.jpg'

source: 'files/me.jpg'

MDLabel:

text:"QR CODE PROJECT"

font_style:'H5'

pos_hint:{'center_y':.85}

halign:'center'

MDLabel:

text:"Made By : Coding PLEX"

font_style:'H6'

pos_hint:{'center_y':.46}

halign:'center'

BoxLayout:

size_hint_y:.06

padding: "10dp"

pos_hint:{'center_y':.3}

MDTextField:

hint_text: "Website : https://coding-plex.blogspot.com"

multiline:"false"

icon_right_color: app.theme_cls.primary_color

readonly : "True"

color_mode: 'custom'

helper_text_mode: "on_focus"

icon_right: 'link'

MDRectangleFlatButton:

text:'Back'

on_release: root.current="a"

pos_hint:{'center_x':.5,'center_y':.1}




Click on the Button Below To Download the Code




Post a Comment

0 Comments