Python Forum
[Tkinter] Help with input from specific devices
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Help with input from specific devices
#1
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)
Reply
#2
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
@buran, if I disable the box, wouldn’t that stop all entry into said box?
Reply
#4
Disabling a control means it won't take mouse or keyboard focus. You can still set the value programmatically.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Looking for good GUI Framework for Touch Devices matt_the_hall 2 2,207 Feb-02-2021, 03:36 AM
Last Post: matt_the_hall
  PyQt5: How do you set the user input of a line edit to a specific variable? YoshikageKira 17 11,712 Dec-26-2019, 03:18 PM
Last Post: Denni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020