Pausing a task / clearing a label

We have decided to use tasks for our gameLoop, instead of intervals, which are easy to pause.

I have not been able to find anything about pausing tasks
Does anyone know of a way to do it, please?

Anyway, I am working my way around it, if it is impossible to pause the task:
I simply subtract the time passed during the paused loop on the clock.

We use DirectLabel to display the clock:
self.guiTimerLabel = DirectLabel()

Now I would like to write “Game is paused” instead of displaying the time (which flickers due to my trick) - but how do I clear the text string in the Label?
Right now my new text is displayed on top of the old … not very elegant :slight_smile:

Thanks for your attention.

Instead of creating a new label each time (which will just stack up your labels on top of each other), change the text on your existing label like this:

self.guiTimerLabel['text'] = "New text"

“Pausing” a task may be as simple as removing it from the task manager, and then adding it again later:



slaps her forehead
Ah, I am making a new instance of the label - that’s why.
Thanks David.

I was afraid that removing a task would delete it all together; but I guess the only thing I really need to save is the current time. I will try this.
Thanks again.