[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] getting what an user has written
Hello. I use this script in a class to get the string what user had written:
string.string=u""
strfont=pygame.font.Font(None,16)
for udalost in pygame.event.get():
if udalost.type == KEYDOWN:
if udalost.key == K_RETURN: exit=1
elif udalost.key == K_BACKSPACE:
self.string=self.string[:-1]
text=strfont.render(self.string,0,(0,0,0))
elif not strfont.size(self.string+udalost.unicode)[0]>mw-8:
self.string+=udalost.unicode
text=strfont.render(self.string,0,(0,0,0))
Everything works fine except that i get unicode string in another encoding, which I don't want. Can somebody tell me which coding pygame uses and/or how to translate it to utf-8 encoding?