0

I've tried all the options below, listed in prior attempts to answer this question.

I also tried to get the Console screen dimensions, but couldn't get them.

If nothing has changed, or there is nothing I can do on windows 8.1 using PyDev - LiClipse IDE, then

I want to just refresh a simple board game screen, similar to noughts and crosses, and want to spend minimum time on the UI. Are there any simple libraries that can do this for me? Just really the simplest thing, I need a UI similar to battleships, and I need to be able to refresh it, because clearing the screen with line breaks, always puts the cursor in a weird place and make it messy.

def clear():
os.system("clear")
print 'clear?'
os.system('CLS')
print 'clear2?' 
sys.stderr.write("\x1b[2J\x1b[H")
print 'clear3?'
os.system('cls' if os.name == 'nt' else 'clear')
print 'clear4?'
print(chr(27) + "[2J")
print 'clear5?'
return

Any help is appreciated.

ZdaR
  • 22,343
  • 7
  • 66
  • 87
Sam
  • 1,659
  • 4
  • 23
  • 42
  • Have you tried running `cls` or `clear` in your command prompt? Is Windows 8.1's `os.name` still `'nt'`? – jonrsharpe Apr 30 '15 at 16:34
  • Thanks Jon Sharp. I need it as part of the game, not as user input during the game to make it work. But I haven't tried anything from the command prompt no. – Sam Apr 30 '15 at 18:19
  • my point is that if you can clear the command line *from the command line*, then the same command should work via `os.system`. – jonrsharpe Apr 30 '15 at 18:52

0 Answers0