← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #284732]: Using curses module with sikuli

 

Question #284732 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/284732

    Status: Answered => Solved

Brad confirmed that the question is solved:
Here's something that might help.  I took what you said and researched
it and came across this bit of code...

import os
#define
def clearscreen():
    os.system('cls' if os.name=='nt' else 'clear')
# now, to clear the screen
clearscreen()

Tried that and didn't work (I have added import os to the top of my script), I then modified to...
def clearscreen():
    if os.name=='nt': os.system('cls')
    else: os.system('clear')

still no luck and then I added this...
print os.name

and it prints out...
java

I then started looking through java console commands to clear the screen and have tried
def clearscreen():
    print os.name
    if os.name=='nt': os.system('cls')  
    elif os.name == 'java': 
        print "\u001b[2J\u001b[H",
        print "\033[2J",
        print "\x1B[H\x1B[J",
    else: os.system('clear')

No errors anymore, it prints java and then the three java print lines
(which I just copied and pasted from a "Clear console in java" search)
don't print anything and script continues as normal.  I'm surprised the
os.name responds with java.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.