1
+ '''Python Program - QR Code generating by DJ Harshit'''
2
+
3
+ # Importing the modules
4
+ from tkinter import *
5
+ import time
6
+ import pyqrcode
7
+
8
+ def gen_qr ():
9
+ global qr , img
10
+ qr = pyqrcode .QRCode (con .get ())
11
+ qr_xbm = qr .xbm (scale = 5 )
12
+ img = BitmapImage (data = qr_xbm , foreground = 'black' , background = 'white' )
13
+ l4 .config (image = img )
14
+
15
+ def save ():
16
+ gen_qr ()
17
+ tme = time .time ()
18
+ qr .png (f'{ tme } .png' , scale = 8 )
19
+ con .set ('' )
20
+
21
+ # Main program
22
+ wind = Tk ()
23
+ wind .title ('QR Code Gen' )
24
+ wind .geometry ('500x400' )
25
+ wind .resizable (0 ,0 )
26
+
27
+ # Variable
28
+ con = StringVar ()
29
+
30
+ f1 = Frame (wind , width = 500 , height = 100 )
31
+ f1 .pack ()
32
+ f2 = Frame (wind , width = 500 , height = 50 )
33
+ f2 .pack ()
34
+ f3 = Frame (wind , width = 500 , height = 250 )
35
+ f3 .pack ()
36
+
37
+ l1 = Label (f1 , text = 'QR Code Generator' , font = ('SugarFont Bold' , 30 , 'bold' ))
38
+ l1 .grid (row = 0 , column = 0 , columnspan = 3 , padx = 5 , pady = 10 )
39
+ l2 = Label (f1 , text = 'By Harshit' , font = ('Arial Rounded MT Bold' , 15 ))
40
+ l2 .grid (row = 0 , column = 4 , sticky = 'w' , pady = 10 )
41
+
42
+ l3 = Label (f2 , font = ('' , 10 ), text = 'Enter the content' )
43
+ l3 .grid (row = 0 , column = 0 , padx = 5 )
44
+
45
+ e1 = Entry (f2 , textvariable = con , width = 40 )
46
+ e1 .grid (row = 0 , column = 1 , padx = 5 )
47
+
48
+ b1 = Button (f2 , text = 'Generate' , command = gen_qr )
49
+ b1 .grid (row = 1 , column = 0 , pady = 10 )
50
+
51
+ b2 = Button (f2 , text = 'Save' , command = save )
52
+ b2 .grid (row = 1 , column = 1 , pady = 10 )
53
+
54
+ l4 = Label (f3 , pady = 5 )
55
+ l4 .pack ()
56
+
57
+ wind .mainloop ()
0 commit comments