![]() |
[Tkinter] Help with input from specific devices - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Help with input from specific devices (/thread-32273.html) |
Help with input from specific devices - Noob_hobbyist - Feb-01-2021 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) RE: Help with input from specific devices - buran - Feb-01-2021 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. RE: Help with input from specific devices - Noob_hobbyist - Feb-02-2021 @buran, if I disable the box, wouldn’t that stop all entry into said box? RE: Help with input from specific devices - deanhystad - Feb-02-2021 Disabling a control means it won't take mouse or keyboard focus. You can still set the value programmatically. |