pygame Framework Font Troubles

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
maselphie
Regular
Posts: 71
Joined: Fri May 23, 2008 2:12 pm
Projects: By The Lake, Seraphine
Location: USA
Contact:

pygame Framework Font Troubles

#1 Post by maselphie » Tue Jul 22, 2008 8:44 am

Oh no! Another font thread. But this is about the Ren'Py pygame framework. ^^;;
I'm still very beginner with Python coding, but I've been working with the pygame demo. I've tried everything, but I can't seem to define fonts. It's driving me literally crazy, so I worked up the courage to ask the gurus here. I figure this is a silly error on my part, like misplacement, or a misunderstanding of renpygame's call codes ...

Code: Select all

pygame.font.init()
MY_FONT = pygame.font.Font("SUPERHEL.ttf", 15)
As well as the variations that include "os_path_join(...)" to point to a font, all result in this error:

Code: Select all

  File "config.py", line 60, in <module>
  File "C:\...\Ren'Py\renpygame-demo\renpygame\font.py", line 35, in Font
error: font not initialized
As shown, I have a separate "config.py" file that I call, so I need it to be a global variable, but the error is the same anywhere I place it.
I've been reading the "aliens.py" from the demo like a bible, which helped for other instances, but not with fonts yet.

Any insight would be very, very much appreciated.
I have switched accounts to Aleema.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: pygame Framework Font Troubles

#2 Post by PyTom » Tue Jul 22, 2008 10:20 am

Hm... you shouldn't create a font as a global variable, as that's too early. In renpygame, you can't do a pygame call until after Ren'Py has initialized, which is after the Ren'Py game has started.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

maselphie
Regular
Posts: 71
Joined: Fri May 23, 2008 2:12 pm
Projects: By The Lake, Seraphine
Location: USA
Contact:

Re: pygame Framework Font Troubles

#3 Post by maselphie » Tue Jul 22, 2008 11:36 pm

That makes perfect sense! Thank you very much.
I have switched accounts to Aleema.

Post Reply

Who is online

Users browsing this forum: Google [Bot]