• Advertisement
Sign in to follow this  

How to clear screen in python

This topic is 1402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OKay, so i've been learning python for the last month and three weeks using the python IDLE, but it's become really annoying to see the games i make stack up all the text on top of each other. Is there any way that i can make it so that the screen is cleared and the game is updated and re-shown to the player? thanks.

Share this post


Link to post
Share on other sites
Advertisement

Try this:

import os
os.system('cls')

on windows or this on linux:

os.system('clear')

Good Luck!

Share this post


Link to post
Share on other sites

Thank you weberM that worked perfectly, and Oralordos XD lmaoo yea i guess that could work too, but then you'd have a scrolling bar on the side which i wouldn't want there

Share this post


Link to post
Share on other sites

To make your code more cross platform you can use sys.platform to find out what os you are running on.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement