Re: [spyder] dynamic printing in one line

1,035 views
Skip to first unread message

Carlos Córdoba

unread,
May 20, 2013, 10:14:26 PM5/20/13
to spyd...@googlegroups.com
Hi Konstantin,

This happens because our console is not a real one, it's just emulating a Python console inside a graphical interface. That's why things like "\b" and "\r" don't work. For more information please see our Issue 195.

But I think the IPython guys have solved this problem, so if you have the chance please update to Spyder 2.2 and IPython 0.13.2.

Cheers,
Carlos

El 20/05/13 06:10, Konstantin Klementiev escribió:
Hello all,

I am trying to dynamically write to the same line of the console. The code below does work in standard consoles but dosn't work in Spyder, at least with its default settings. Why?
I am working under Windows, Spyder 2.1.11.

import sys
import time

sys.stdout.write('static and ')
last_lenght = 0
for i in "\\|/-\\|/-":
    sys.stdout.write('\b' * last_lenght)    # go back
    sys.stdout.write(' ' * last_lenght)     # clear last dynamic output
    sys.stdout.write('\b' * last_lenght)    # reposition
    outText = i + 'dynamic'
    sys.stdout.write(outText)
    last_lenght = len(outText)
    sys.stdout.flush()
    time.sleep(0.5)
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Konstantin Klementiev

unread,
May 21, 2013, 4:01:38 AM5/21/13
to spyd...@googlegroups.com
Hola Carlos,

Now I have both  Spyder 2.2 and IPython 0.13.2 installed and the broken printing is still there. Ok, I see there is no easy solution. 

Thanks for replying!
Regards,
Konstantin

Carlos Córdoba

unread,
May 21, 2013, 7:03:22 AM5/21/13
to spyd...@googlegroups.com
You just need to evaluate your expression in an *IPython* console, not in a python one. I did it last night and I could see an spinning indicator next to some text. Very cool!

Cheers,
Carlos

El 21/05/13 03:01, Konstantin Klementiev escribió:

Konstantin Klementiev

unread,
May 21, 2013, 10:13:56 AM5/21/13
to spyd...@googlegroups.com
You're right, I have now told Spyder to use the current IPython console in Run/Configure and it works!
Thanks!
Konstantin
Reply all
Reply to author
Forward
0 new messages