![]() |
QR Generator and Reader base on Python Tkinter. |
Good morning, good people! I hope you're all in good health and spirits. Today I have some more program to show you and it is QR Code Generator and Reader. The idea to make this program is from 2023 when I need to expand my skill in Tkinter GUI in Python programming. Let's take a look!
MVC Design
What is MVC? MVC, which stands for Model-View-Controller, is a design pattern used in software engineering to separate an application into three interconnected components. This separation helps in organizing code, making it more modular, and managing complex applications.
So whenever I need to change the GUI or adding more feature or fixing bug, it can be done easily with MVC design pattern.
![]() |
MVC software design architecture. |
The GUI
The GUI is indeed simple and has a classic look, but the rest of the program is stable and functional. I use custom widgets to build most of my GUI programs, as shown in the MVC section under 'custom_widgets.py'. When I need to update the appearance of the GUI, for example adding marquee text in an entry field, I go to 'custom_widgets.py' and add a new custom widget or modify related widget.
![]() |
The custom_widgets.py module. |
Generate A QR Code
I have limited the input text in the entry field to 100 characters. However, this rule can be adjusted based on user requirements. I will demonstrate how to generate text into a QR code, which people can use for their promotional needs or other purposes:
![]() |
Generate text into QR Code image. |
The text that I input is displayed below the QR image. The program automatically reads the QR image. Hit the 'Enter' key or click 'Generate' button to generate the QR image. To save, just press 'Ctrl+S' or click the 'Save' button. A file save dialog will then pop up as shown below:
![]() |
Save the QR image file. |
Reading QR Code Image
![]() |
Reading QR Code image. |
The program can read images in PNG, JPEG, JPG, and ICO formats. It runs stably on both Windows and Linux OS.
End...
That's all I can demonstrate to you about this program. I wish you a great day!
P.S
When I program, I use interchangeable operating systems simultaneously between a Windows virtual machine and a Linux host machine. If the switching images caused any confusion, I apologize. Thank you for your understanding and for visiting.