Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 187779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:53:03+00:00 2026-05-11T15:53:03+00:00

I want to do an app constantly watching the serial port and changing the

  • 0

I want to do an app constantly watching the serial port and changing the user interface according to the input received from the port. I’ve managed to read lines from the port with pyserial under Linux, but I’m not sure how to do this in a regular fashion: create a separate thread and check for input on a timer event? How do i make sure I don’t miss anything? (implementing some kind of handshake/protocol seems like an overkill for this…) And most importantly: How do I do it with the facilities of qt4?

Edit: This is what I’m doing now (I want to do this periodically with the rest of the app running and not waiting)

class MessageBox(QtGui.QWidget):     def __init__(self, parent=None):         QtGui.QWidget.__init__(self, parent)          ser = serial.Serial('/dev/ttyS0', 9600, bytesize=serial.EIGHTBITS,         parity=serial.PARITY_NONE,              stopbits=serial.STOPBITS_ONE,          timeout=None,                    xonxoff=0,                       rtscts=0,         interCharTimeout=None)          self.label = QtGui.QLabel(ser.readline(), self)         self.label.move(15, 10)         ser.close()         self.setGeometry(300, 300, 250, 150)         self.setWindowTitle('Authentication')          self.color = QtGui.QColor(0, 0, 0)           self.square = QtGui.QWidget(self)         self.square.setGeometry(120, 20, 100, 100)         self.square.setStyleSheet('QWidget { background-color: %s }' % self.color.name()) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:53:04+00:00Added an answer on May 11, 2026 at 3:53 pm

    You won’t miss any bytes, any pending input is buffered.

    You have several options:

    1. use a thread that polls the serial port with PySerial/inWaiting()

    2. Use a timer in the main thread that polls the serial port with PySerial/inWaiting.

    3. find the handle of the port and pass it to QSocketNotifier. This works only on linux but in that case, QSocketNotifier will watch the file associated with your serial port and send a signal when there’s something available.

    Method 2 and 3 are better because you don’t need a thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an app which constantly receives Heart Rate from a bluetooth device in
I want to allow my app to send GPS data to server constantly in
I'm developing an iOS application which deals with constantly changing data which is read
I'm writting an ASP.NET MVC e-commerce app using NHibernate and I want the end-user
I want my app to be hw accelerated in ICS, but support of 2.3.3
I want my app to store multiple objects locally for later use. Now, my
I want my app to stop playing video after specific time period (say 30
I want my app to be available for both phones and tablets. The only
I want my app to display measurements in US or Metric based on the
I want my app to catch downloads of a particular kind of file. Here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.