[Tutor] serial connection was: adding a listbox

vicki@stanfield.net vicki@stanfield.net
Mon Feb 24 10:56:00 2003


Strange, but I can't get it to work with your code, but
if I change the "import serial" to "import Serial", the
code will at least bring up the listbox with buttons.
When I use the menu to actually execute the serial code
(in callback), however, I get this:

TypeError: 'module' is not callable

So, I'd guess that I don't understand how modules are
named and exactly what is being called within the
module. I know that there are class definitions and
function definitions within the module. The folder that
got installed when I installed the serial stuff is
"Serial" and the python script within that folder is
also called "Serial". Can you tell me what I am missing?
 
> 
> import serial
> 
> ser = serial.Serial(0, timeout=1)
> 
> ser.write("Something")
> 
> input = ser.read() #reads one byte
> input = ser.readline() #reads a line
> input = ser.read(7) # reads 7 bytes
> 
> ser.close()