How to input data through QR code scanner in python tkinter - python

I create a billing system, which involves scanning QR code and inputting the data into the fields item and quantity as shown in picture. However I'm unable to figure out how to upload the data into the fields. My scanner is able to decode the QR code, but how do I fill in the fields automatically as I scan my code. Is there a way to do this?
I used tkinter along with Python latest version.
my output application:output
What widget do I use and what command do I use to do this? if you need further details regarding the project please do comment. I'll be grateful to receive any kind of directions or advice regarding my project!

Related

I need to hook HTML input into Python and don't know how

I am working on a team project for a capstone course. We have decided to produce a self-hosted calendar app for college students. One team member has created HTML webpages for said self-hosted server. I need to hook button and text box input and output into a python program. We are using Starlette, but I cannot figure out how to get information from text boxes.
To give an example of what I need to do, the user will input information into a selection of text boxes. That info needs to be read and converted into variables, then sent into an SQL statement. I have the SQL done, I just don't know how to read the info from the HTML boxes and detect button input.
Before answering it is necessary to know if you are using a python framework, ideally it would be enough to change the action of the form and connect it with a python function.
Here I leave you a tutorial to clarify a little bit the panorama.
https://www.youtube.com/watch?v=dlhg8HMZTOk

escpos printer image not getting align to center

I am using escpos for printing the Token in our Queue managment system python. I need to put the company logo in header of the token. I am trying to do the same as below.
printer.set(align='center')
#printer.qr("You can readme from your smartphone")
printer.image("index/index_statics/img/brand/Webp.net-resizeimage.png")
But the image is always alignef to left. I have seen many links on the same. but nothing that I can understant. I am very new it. Please help to understand the issue and please help me to resolve the same. The printer is ZKTeco (ZKP8008) termal printer
This is not an ESC/POS question. Just that the printer can interpret ESC/POS does not mean that escpos is the good category for a framework/library question.

Interfacing a QR code recognition to a django database

I'm coming to you with the following issue:
I have a bunch of physical boxes onto which I still stick QR codes generated using a python module named qrcode. In a nutshell, what I would like to do is everytime someone wants to take the object contained in a box, he scans the qr code with his phone, then takes it and put it back when he is done, not forgetting to scan the QR code again.
Pretty simple, isn't it?
I already have a django table containing all my objects.
Now my question is related to the design. I suspect the easiest way to achieve that is to have a POST request link in the QR code which will create a new entry in a table with the name of the object that has been picked or put back, the time (I would like to store this information).
If that's the correct way to do, how would you approach it? I'm not too sure I see how to make a POST request with a QR code. Would you have any idea?
Thanks.
PS: Another alternative I can think of would be to a link in the QR code to a form with a dummy button the user would click on. Once clicked the button would update the database. But I would fine a solution without any button more convenient...
The question boils down to a few choices: (a) what data do you want to encode into the QR code; (b) what app will you use to scan the QR code; and (c) how do you want the app to use / respond to the encoded data.
If you want your users to use off-the-shelf QR code readers (like free smartphone apps), then encoding a full URL to the appropriate API on your backend makes sense. Whether this should be a GET or POST depends on the QR code reader. I'd expect most to use GET, but you should verify that for your choice of app. That should be functionally fine, if you don't have any concerns about who should be able to scan the code.
If you want more control, e.g. you'd like to keep track of who scanned the code or other info not available to the server side just from a static URL request, you need a different approach. Something like, store the item ID (not URL) in the QR code; create your own simple QR code scanner app (many good examples exist) and add a little extra logic to that client, like requiring the user to log in with an ID + password, and build the URL dynamically from the item ID and the user ID. Many security variations possible (like JWT token) -- how you do that won't be dictated by the contents of the QR code. You could do a lot of other things in that QR code scanner / client, like add GPS location, ask the user to indicate why or where they're taking the item, etc.
So you can choose between a simple way with no controls, and a more complex way that would allow you to layer in whatever other controls and extra data you need.
If security is not a big concern: an API with a simple get method that takes as argument the object id and I will presume you have the code to make sure if the object is given as taken it will be switched to returned.
And why not post? POST needs headers that you can't include in qr unless you have a dedicated app, so GET and the ability to use example.com/api/leaseandret?id=12345 is a better alternative that allows for better usage with a QR.
A summary of the methods*
* A note here is that GET is not forbidden from being used to modify data and send data to a server GET is exclusively for getting data from a REST purist standpoint.

implementation of vtk boxwidget2

Currently, I am trying to write a script to select the visualized points with user interaction. I looked through vtk sources and it seems one can use widget called vtkBoxWidget2 to select. However, I can not find an example in python.
My aim is to let user resize and modify the boxwidget (that's easy with the pipeline ) and then select the points inside of the box and return the selected point ids
I would appreciate if anyone could share a snippet of the codes for this task in python.
Thanks in advance
There is an example where the usage of vtkBoxWidget2 is demonstrated. It is located in the VTK source directory:
interaction/Widgets/Testing/Python/TestInteractorEventRecorder.py
Or just grab it from the VTK repository on github.

QGIS layer: import CSV and set 'Display HTML Map Tip' using python

My objective is to generate a python plug-in for QGIS that will open a CSV and define a field within the table to display as a map tip.
I'm trying to achieve this task and have got stuck on trying to set the layer properties using python, rather than opening the 'layer properties' dialog, selecting the Display tab and entering HTML expression...
the HTML expression I'm trying to insert into the layer properties is:
field1= '<b>\"title\"</b><br/>\n'+'[%CONCAT(\'<img src=\"\',\"file\",\'\" width=\"400\"></img>\')%]'
where "title" and "file" are fields within the CSV, giving rise to:
<b>"title"</b><br/>
[%CONCAT('<img src="',"file",'" width="400"></img>')%]
This gives me the right HTML to slot into a relevant place - and it works when I use this manually, but I'm now lost trying to find how to change the layer properties using python...
There seems to be a function called
setDisplayAttributes but I can't really follow the API description well enough to understand whether it is the correct function and I can't find any examples using this function.
Any help would be appreciated - I'm a toddler with Python but probably pre-pubescent with QGIS (Version 2.8 on Windows 10) so if you are able to work in words of less than 47 syllables that would be grand.
Many thanks in advance.
EDIT: I've realised this might not be the right place for this
question so have posted on GIS.stackexchange. My apologies and I will
update whichever one gets answered so that folk can find it. If you
choose to vote this down for my stupidity, so be it.
You can find the other version here:
https://gis.stackexchange.com/questions/169997/qgis-layer-import-csv-and-set-display-html-map-tip-using-python

Categories

Resources