Try doing this instead:
# -*- encoding: utf-8 -*-
import pygame
from pygame import constants, event, display
from pygame import freetype
pygame.init()
freetype.init()
screen = display.set_mode((300, 200))
screen.fill(pygame.Color('White'))
f = pygame.freetype.SysFont('Times New Roman', 19)
f.underline = True
s, rec = f.render(u'Amazon')
try:
loop = True
while loop:
for ev in event.get():
if ev.type == constants.QUIT:
loop = False
elif ev.type == constants.KEYDOWN and ev.key ==
constants.K_ESCAPE:
loop = False
screen.blit(s, (10, 30))
display.flip()
finally:
freetype.quit()
display.quit()
On Thu, Mar 12, 2015 at 11:06 AM, Benni Bärmann <[email protected]>
wrote:
> no crash in linux here. looks like a windows specific problem.
>
> 2015-03-12 14:38 GMT+01:00 Bo Jangeborg <[email protected]>:
>
>> How stable is the freetype module ? I have been running into problems
>> with it hanging my app completly. The following code should demonstrate
>> the problem. Pressing ESC and you'll see that it has crashed. However
>> if you set the underline parameter to 'False' things work nicely.
>> I am running it on Windows 7.
>>
>> # -*- encoding: utf-8 -*-
>> import pygame
>> from pygame import constants, event, display
>> from pygame import freetype
>>
>> pygame.init()
>> freetype.init()
>> screen = display.set_mode((300, 200))
>> display.flip()
>> screen.fill(pygame.Color('White'))
>> display.flip()
>> f = pygame.freetype.SysFont('Times New Roman', 19)
>> f.underline = True
>> s, rec = f.render(u'Amazon')
>> screen.blit(s, (10, 30))
>> display.flip()
>>
>> try:
>> loop = True
>> while loop:
>> for ev in event.get():
>> if ev.type == constants.QUIT:
>> loop = False
>> elif ev.type == constants.KEYDOWN and ev.key ==
>> constants.K_ESCAPE:
>> loop = False
>> finally:
>> freetype.quit()
>> display.quit()
>>
>
>