Hello
I’m trying to put special characters (ñ) on the screen using OnscreenText, but not how. The first line of my py file is # - * - coding: utf-8 - * - and in my Config.prc file I have utf8 text-encoding. Someone could help me with the following code? Thank you.
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
class App(ShowBase):
def __init__(self):
ShowBase.__init__(self)
texto = 'contraseña'
OnscreenText(bg = (0,0,0,47.0/255), text = texto,
fg = (246.0/255, 205.0/255, 11.0/255, 1),pos = (0,0), scale = 0.1)
App().run()
I know I was using non-ascii leters in direct gui and dgui uses the TextNode just like on screen text, so it should work. I’ll check what I did to make sure on the morrow, one more thing that comes to mind is to try the text as explicit unicode:
u’contraseña’