Python Forum
Read Data from Serial port - 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: Read Data from Serial port (/thread-24648.html)



Read Data from Serial port - PA3040 - Feb-25-2020

Hi Team

Is Amy one who have code for read data from Serial port like Arduino and put the reading to the Entry Widgets or Text widget

I have a code which can read data coming from Serial port and it showing on the Python shell . But I need to visible it on the Entry Widget or Text Widget

Note: I can manage Arduino code Therefore I not need Adruino code

Thanks in advanced


RE: Read Data from Serial port - Larz60+ - Feb-25-2020

you can use pyserial, to install pip install pyserial
documentation has ample examples: https://pythonhosted.org/pyserial/


RE: Read Data from Serial port - Denni - Feb-25-2020

@PA3040 I have done this already and what @Larz60+ pointed out is one way to get started on that but once you do get that you are going to discover lots of little oddities and unfriendlinesses with it -- unless you have someone who can point those out to you in advance still...

If you already have a python program that pulls data from a serial device through a serial port then make that its own separate class and using whatever you already are using (aka you do not need pyserial) just send that data to your python-qt application. I can show you how to do this as well if you are wanting help with that. Basically use the MVC methodology keeping your Data Source (Model) completely separated from your GUI (View) and passing that data through your Controller module