curses won't refresh screen

2006-01-28 Thread Casey Bralla
For some reason, I can't get curses to refresh the screen.  Can someone
offer a suggestion to try to debug this?

Here is my python code snippet:

stdscr=curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
global screen
screen = stdscr.subwin(23, 79, 0, 0)
screen.border()

while 1 == 1:
screen.addstr(5,5, str(time.localtime()))
screen.refresh()



When  run this, the local time is displayed ONCE, and then never changes. 
Why isn't the screen.refresh() command refreshing the display?

I'm running a terminal session from within KDE, but I didn't think this
would matter.

Any ideas to suggest?
-- 
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
http://www.NerdWorld.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Curses won't update screen - Solved!

2006-01-28 Thread Casey Bralla
My problem was caused by a getch() function which paused, waiting for the
character.  Live and learn.  sigh

For some reason, I can't get curses to refresh the screen.  Can someone
offer a suggestion to try to debug this?

Here is my python code snippet:

stdscr=curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
global screen
screen = stdscr.subwin(23, 79, 0, 0)
screen.border()

while 1 == 1:
        screen.addstr(5,5, str(time.localtime()))
        screen.refresh()

KeyPress = screen.getch()



When  run this, the local time is displayed ONCE, and then never changes. 
Why isn't the screen.refresh() command refreshing the display?

I'm running a terminal session from within KDE, but I didn't think this
would matter.

Any ideas to suggest?
-- 
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
http://www.NerdWorld.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Read from Serial Port

2006-01-20 Thread Casey Bralla
I'd like to read ASCII data from a serial port, but (once again) I'm having
trouble getting started.  (Can't seem to find the basic level of docs to
get going sigh)

I'd like to use only standard built-in modules if possible.

Could somebody offer a simple code-snippet to get me started reading from a
serial port?

Thanks!
-- 
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
http://www.NerdWorld.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Return Text from popen

2005-10-15 Thread Casey Bralla
I know this problem has a very simple answer, but I've checked the web and I
don't understand the answers that I've found.

How do I return text from a standard Linux command?

For example:  I want to read the stdout results of a typical linux command
(such as df) into a Python variable.

I've tried these techniques:

 result = os.system(df)
 It dumps the stdout to a screen and puts the result code into result

 result = popen2(df)
 It gives me a tuple of the stdin  stdout pipes, which I don't know how to
harvest into the actual stdout result.


Can someone give me a brief code example of how to get the actual text
result from the linux command into a Python variable?  Thanks!

-- 
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
http://www.NerdWorld.org
-- 
http://mail.python.org/mailman/listinfo/python-list