about dialogs (again)

So now i have an image, a wordwrapped text that loads 2 lines at a time on the image, after u press Enter, and unloads everything after the final line was displayed.
Its almost done, only one thing: how can i make the text appear slowly like here:
just an example.
I use this to display the text:

Create a task that adds one letter to the text every few milliseconds.


I thought of tasks…
But i still dont know how to actually do that.

import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
from pandac.PandaModules import *

class UpdatingText(object):
    def __init__(self, your_text):
        self.text = list(your_text)
        self.temp = ""
        self.onscreendisplay = OnscreenText(
                text="", pos=(0, 0), scale=0.1)
        # uncomment the next 3 lines for left-aligned text
        #self.onscreendisplay = OnscreenText(
        #        text="", pos=(-0.99, 0), scale=0.1,
        #        align=TextNode.ALeft)

        timestep = 0.1  # seconds
        taskMgr.doMethodLater(timestep, self.addLetters, "add letters")

    def addLetters(self, task):
            self.temp += self.text.pop()
            return task.again
        except IndexError:
            return task.done

UpdatingText("The flying spaghetti monster greets you, humble human.")

How about posting that in the Snippets section?

not necessary - for most people such things are obvious. but feel free to expand it and post as a snippet then :slight_smile: