How to use setCardTexture function in TextNode class

Two question:
1 How to use setCardTexture function in TextNode class?

def initText(self):
    self.text = TextNode("text node")
    font = loader.loadFont("CALIBRIZ.TTF")






    texture = loader.loadTexture("test.jpg")

    textNodePath =

the card hasn’t a texture on it. And I print texture, it’s loaded successful. So what happened? how to use setCardTexture ?

2 Another question: how to hide a TextNode? For example, when my character sayes some words, the textnode will show with the words. After seconds, the textnode will disappear. How to do it ?


I don’t know about (1), but you can simply hide your text by calling the show() and hide() functions on your textNodePath.

OK. Thank you very much.

About 1, that’s my texture file’s size isn’t %8=0.
About 2, it is successful as what you said.

So other questions:
1-- When I used card, the text won’t be shown in the TextNode. and if I del the codes about card, the text will be shown. Perhaps the card covered the text?

2–When I load a *.avi as texture, it is shown in the TextNode, the video will be shown ,but no sound is played. If I used loader.loadSfx(avi) and texture.synchronizeTo(sound), the video will be unshown, and no sound.In other words, no video no sound. Why?

I tried 2 again. When I use the instand of using synchronize, the video work, the sound work. But why synchronize failed?
Maybe it is relatived with question 1

I tried 2 again ,too. HAHAHA. Maybe my avi file has some problems, bcz when I used PandaSneezes.avi in Media-Player. It worked. But, the video isn’t play ,it is still. Audio isn’t play ,too. What’s wrong with it?
In Media-Player, there isn’t any obvious codes like play().

And I read the manual about Non power-of-two texture. The PandaSneezes.avi is non power-of-two, but I cann’t find any codes to deal with it and it is playing well. So , why?
In manual, it sayes:To work around this limit, you have to display just the lower-left portion of the texture

I cann’t understand this words very well. So I looked for answer in Media-Player,but nothing found

The cards are by default formatted for display in render2d, which requires a different system for guaranteeing ordering than display in render. If you want your text to be displayed with a background card in the 3-D scene, use:


As to the avi videos, Panda will automatically handle the power-of-2 issue when you load a non-power-2 movie texture. It does this by framing the texture in the lower-left corner, leaving the rest of the texture blank, and adjusting the UV’s to match. Of course, the UV’s on your texture card won’t automatically match, but you can call get.getTexScale() to get the appropriate texture scale to apply to the card.

Panda is supposed to automatically scale your non-power-2 static textures too, unless you disable this with “textures-power-2” in your Config.prc file, or if you construct a texture by loading a PNMImage at runtime or something like that.