from 
http://scientificcomputingco.blogspot.com/2013/10/python-spyder-clear-workspaceshell.html
add the following to 
C:/Python27/Lib/site-packages/spyderlib/scientific_startup.py 
(I inserted it at the end of the file)

#==================
# clear functions from 
http://scientificcomputingco.blogspot.com/2013/10/python-spyder-clear-workspaceshell.html
#===================
def clear():
        '''Clears the shell of the spyder application
        Use either clear() or cls()'''
        os.system('cls')
        return None
cls = clear

def clear_all():
    '''Clears all the variables from the workspace of the spyder 
application.'''
    cls()
    gl = globals().copy()
    for var in gl:
        if var[0] == '_': continue
        if 'func' in str(globals()[var]): continue
        if 'module' in str(globals()[var]): continue

        del globals()[var]

setscientific()
del setscientific
clear_all()
print 'Type "scientific" for more details.'

I'm getting an error saying that setscientific() is not defined though when 
I start spyder and an error saying "The system cannot find the path 
specified" when I run the clear_all() command.
But it seems to work regardless, clears all the variables from the Variable 
Explorer.


On Tuesday, March 23, 2010 7:11:49 AM UTC-7, Duim wrote:
>
> ok, thank you.
>
> There isn't a command which I can use in my python script?
>
> I would like the same for a "clear workspace"
>
> Reason I'm asking is that I'm using Spyder often like I used to use
> Matlab and I'm looking for the same thing as matlab functions "clear
> all" and "clc".
>
> On Mar 21, 11:14 am, Pierre Raybaut <[email protected]> wrote:
> > In "Interactive console" menu: click on "Restart Python interpreter".
> >
> > Cheers,
> > Pierre
> >
> > On Mar 19, 11:39 am, Duim <[email protected]> wrote:
> >
> > > First of all: I really like Spyder and use it all the time.
> >
> > > question: Is there a command within Spyder to clear the shell and the
> > > workspace?
> >
> >
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to