User Interface Suggestions? (newbie)

Tim Golden mail at timgolden.me.uk
Thu Oct 6 08:45:41 EDT 2016


On 06/10/2016 13:38, Peter Otten wrote:
> BartC wrote:
>> All this advice seems to be getting out of hand, with suggestions of
>> 'curses' and 'blessings' and using GUI. I've tried 'ncurses' elsewhere
>> and it was over the top for what I wanted to do.
>>
>> The OP wants to runs on Pi which I think runs Linux.
>>
>> So all they are asking is, is there a way of randomly positioning the
>> cursor within the terminal window so that the next output is at that
>> position. Something like an escape sequence. Terminal screens have been
>> around a long time, you'd think someone would have had such a
>> requirement before!
>>
>> I'd quite like to know too. However I've just tried a test sequence
>> ("<esc>[P1d" to move the cursor to row 1) and it didn't work. If there's
>> reason why something so basic won't work (hence the need for curses etc)
>> then that would be useful to know too. (And how does curses manage it?!)
> 
> Perhaps you picked the wrong escape sequence? I tried <esc><line>;<column>H 
> taken from <http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html>, and it 
> seems to work (the test system is not a Pi though):
> 

For lightweight stuff like this, colorama is useful (basically wraps the
ANSI sequences):


https://pypi.python.org/pypi/colorama

TJG




More information about the Python-list mailing list