How Can I add serial comms events to Tkinter mainloop?

Grant Edwards grante at visi.com
Mon Feb 4 13:37:16 EST 2002


In article <ORr78.26230$oK1.225674 at NewsReader>, JH wrote:

> I am trying to write a simple serial console. I was hoping to
> use Tkinter for the GUI but I cannot see how to add RX chars
> from my serial port to the console while Tk.mainloop is running
> is it me ?

You use Tkinter.tkinter.createfilehandler to add a "handler"
routine to a file.  This works for serial ports as well -- at
least under Unix. If you want to see a demo of how this is done
to handle data from a pipe, you can look at 

 ftp://ftp.visi.com/users/grante/python/readHandlerDemo.py

The relevent stuff is in the "start" method of the execWindow
class.

-- 
Grant Edwards                   grante             Yow!  If elected, Zippy
                                  at               pledges to each and every
                               visi.com            American a 55-year-old
                                                   houseboy...



More information about the Python-list mailing list