Ask coding questions

← Back to all posts
Hi guys! I'm new to coding and have a question.
TomasFabbroni (1)

I'm new to this and I want to know how I can remove text shown on screen with new text after a certain amount of time.

Commentshotnewtop
CodingCactus (2527)

you can sleep, clear and re print

is this what you wanted?

TomasFabbroni (1)

@CodingCactus Could you show me how to do that?

CodingCactus (2527)

@TomasFabbroni hrm no sorry, i don't do pygame

maybe use blit() or something, but i don't know sorry

Cookiezz (65)

@TomasFabbroni Do you want to clear the turtle console or the console with the text?


If you want to clear and re-print in the text console:

To sleep: import time or from time import sleep.

For the clear, you can use this that I use: def clear(): os.system('cls' if os.name=='nt' else 'clear')
To use this, write clear() in your code to clear the console.

Then to re-print, print("Whatever you want to print")

If you want to clear the Turtle console:
Note: I am using Python with Turtle instead of importing Turtle.

from turtle import Turtle
t = Turtle()

t.forward(100)
t.clear()