Jollywatt
Jollywatt

Reputation: 1365

(Python) Pygame: render text with special characters ( × ÷ π etc)

This might be a very nooberious question (or it may not), but here it is. I am tying to display special characters on screen (specifically the multiplication symbol '×') using pygame.

The code works like this:

label = helvetica.render("text here", 1, (r, g, b))
window.blit(label, (x, y))

What do I have to put in "text here" in order for this to work? Or is there another way around this?

I have attempted to muck around with the text encoding, using UTF-8 etc... but I hardly know anything about it and I haven't had any success.

Thanks very much in advance!

Upvotes: 1

Views: 707

Answers (1)

Chris Warrick
Chris Warrick

Reputation: 1629

u'×' should be enough. In case it isn’t, add an encoding definition for UTF-8 and save the file as such (without BOM!) In case it still isn’t, this may be a PyGame problem.

Upvotes: 0

Related Questions