我有以下问题: 我正在用pygame、pygtk和pgu在python中为XO(OLPC机器)编写一个问答游戏。 当用户(一个孩子)写东西时,文本区域(来自pgu)不使用特殊字符,如ñ、ó、á等。 我尝试了一个小程序,只与pygame和pgu一起使用,效果很好。我认为问题可能出在pygtk中的unicode,但我不知道如何检查或更正它。在
app = gui.App()#gui is from pgu
c = gui.Container(width =1200,height = 900)
background = pygame.display.get_surface()
app.init(c,background)
#load initial screen
while self.running and salir==1:
background.blit(self.pantalla,(0,0))
x,y = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.running = False
return
if event.type == pygame.KEYDOWN:
if event.unicode.isalnum():
print event.unicode
print "Evento pygame:",event.key
if event.key == pygame.K_DOWN:
exit()
app.event(event)
app.paint(background)
app.update(background)
pygame.display.flip()
#now I have to manage pygtk events:
p = gtk.events_pending()
while p:
gtk.main_iteration()
当我按ñ时,我进入日志文件:key ntilde unrecognized。在
请帮忙,我卡住了,我必须把软件送过来。在
导入gtk时,默认编码将设置为utf-8。在
因为没有gtk它可以正常工作,我想这可能与编码有关。在
相关问题 更多 >
编程相关推荐