[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] PyGlyph: Making Examples Work



On Friday 20 October 2006 01:20, Kris Schnee wrote:
> I'd like to be able to render text in OpenGL so that I can do an
> interface not limited to SDL rendering speeds, but so far I've not
> succeeded. PyGlyph seems like a solution, but its Hello World example
> crashes.
>
> <code>
> Traceback (most recent call last):
>    File "C:\Python24\pyglyph\example\hello.py", line 56, in ?
>      HelloExample().run()
>    File "C:\Python24\pyglyph\example\example_base.py", line 60, in run
>      self.init()
>    File "C:\Python24\pyglyph\example\hello.py", line 30, in init
>      fonts = pyglyph.font.LocalFontFactory(font_dir)
>    File "C:\Python24\pyglyph\font.py", line 117, in __init__
>      self.add(path)
>    File "C:\Python24\pyglyph\font.py", line 130, in add
>      self.add(os.path.join(path, file))
>    File "C:\Python24\pyglyph\font.py", line 132, in add
>      info = pyglyph.ttf.TruetypeInfo(path)
>    File "C:\Python24\pyglyph\ttf.py", line 93, in __init__
>      mmap.MAP_SHARED, mmap.PROT_READ)
> AttributeError: 'module' object has no attribute 'MAP_SHARED'
> </code>

Try changing lines 92 & 93 to read:

        if hasattr(mmap, 'MAP_SHARED'):
            self._data = mmap.mmap(self._fileno, len, mmap.MAP_SHARED,
                mmap.PROT_READ)
        else:
            self._data = mmap.mmap(self._fileno, len, None, mmap.ACCESS_READ)


    Richard