Python Forum

Full Version: Help with input from specific devices
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on making a GUI in tkinter and I have 5 entry boxes. I want each entry box to only accept input from certain devices, such as a scanner or a measurement device. I have tried searching the internet for a few days now, and nothing that I've found really touches on limiting input to only a specific device per entry box.

Basically, in entry boxes 1 and 2, I want to only be able to use a scanner to accept input, and not a keyboard. In entry box 5, I want it to accept input from a measuring device and not a scanner or keyboard. I also would want to make entry box 5 continuously updating (every time the measuring device gets a new measurement, it updates in the GUI) until a button is pressed and it would make the GUI entry static on the last measurement updated.

Is this possible? I don't even know where to start with something like this. I've seen a similar concept done in Java, with things like scanf, but nothing in Python.

I would imagine I would have to start by defining a new input entry, but, like I said earlier, I don't even know where to start. Any help at all would be greatly appreciated.

Here is a sample of one of my entry boxes:

tube_verification_entry = tk.Entry(tube_verification_frame, bg='white')
tube_verification_entry.place(relx=0.45, rely=0.1, relwidth=0.5, relheight=0.8)
I think you look at the problem from a wrong perspective
When you take input from specific device, you should update specific widget(s) - an entry box or simple label.
To prevent user from manually enter into entry box - simply disable it.
@buran, if I disable the box, wouldn’t that stop all entry into said box?
Disabling a control means it won't take mouse or keyboard focus. You can still set the value programmatically.