Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nya-chan Production

Pages: [1]
1
Python / PySFML 1.6 + Python 2.7 cannot load font?
« on: May 30, 2011, 04:17:48 pm »
Got a weird error on Win7, while trying to import font to my game via this class:

Code: [Select]
class StartText(GameText):

    def Create(self, text, xpos, ypos, active):
        font = sf.Font()
        font.LoadFromFile('Arial.ttf')
        self.active = active
        if self.active == False:
            self.text = sf.String(text, font, Size = 10)
        else:
            self.text = sf.String(text, font, Size = 12)
            self.text.Italic
        self.text.SetColor(sf.Color(0, 0, 0))
        self.text.SetPosition(xpos, ypos)


On suggestion from IRC I simplified it to this in a separate file:

Code: [Select]
from PySFML import sf
font = sf.Font()
print 1
font.LoadFromFile(" Arial.ttf ")
print 2


This prints 1 and then crashes without an error, python just stops working. In both cases Arial.ttf is in the same folder as the script and is correctly capitalized. Anyone else experienced this or knows how to fix it? ^^

Pages: [1]
anything