top of page
Writer's pictureYuri Falcão

QR Code Application for Windows (with Python)


So, I was working on labeling instruments with QR Codes to make it easier for our clients to reach each instrument's page and booking system. But everything was working fine except from the #qrcode: Online most websites will charge or put their logos in the middle of the QR Code, and on Excel, Microsoft Office by itself is paid.


This situation inspired Program Coffee to make a simple solution that would just work, no need to navigate the internet, open spreadsheets or anything like that. The workflow is simple: Copy URL; Open QR Code Generator Program; Click to Generate QR Code, Done.


So, no more stories, let's see how the program looks like!



Please make sure python is added to your PATH.


First, open your python IDE (in my case it is PyCharm)


Now create a new main.py file and let's start by importing all necessary modules (remember to also run some pip install for the modules we are using).


Now, we need to prepare a function to save the QR code to an image


And finally, we need to set up an UI to input the URL in a friendly way (I won't be working so much in the UI for now).


With all this set the program should already be working and displaying the interface with the compiler



That looks so nice right? Well we can make it even nicer by making it as a .exe application that can be installed in any Windows computer


For this we will be using the auto-py-to-exe package, that will transform our .py files into .exe files.

The first step is to run pip install auto-py-to-exe. Then we can run it by just runnig the command: python -m auto_py_to_exe (note that files can't have dash in the name, so it is changed to underscore).

If all went we;; you should see the Auto Py to exe interface:

In this interface you can explore different configurations to export your file, but in our case I copied the path to the main.py file that we created, selected One Directory; Window Based (hide the console), and all the other options were selected.

The it is as simple as clicking Convert .PY to .EXE and it is done. you should have a folder called output with your main.exe file!


Congratulations! You have successfully created a Windows application!


Note that this opens doors for many possibilities and for sure we will come back in the future to prepare interfaces for scripts, exporting or converting files, activating functions on MCUs and much more!


The code for this tutorial can be found on: https://github.com/yhde-oliveira-falcao/QRCode-Generator-UI










85 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page