ashground
|
Taking a look at 'textbox.py', I decided I wanted to change the font. Right away, I noticed the quirk--it was apparently using 'system.fnt', but no such thing existed... I tried calling TextBox with TextBox(speech.fnt, "blah", etc, etc), using many different arrangements, but nothing worked. Then I realized that system.fnt didn't seem to be a file call, but a reference to a class variable... and this has something to do with the mysterious 'import system' call at the top of 'outside.py'...
I tried changing the font directly in the definition of TextBox, with 'font=Font("speech.fnt")', but everything seems to just generate errors!
So, what IS 'system.fnt', and how can you change the font that TextBox uses?
Posted on 2001-08-17 03:40:35
|
Rayner
|
SYSTEM.FNT does NOT refer to a file named system.fnt. That specific TextBox function can only be given font objects [gamefont=Font("myfont.fnt") - gamefont being the object]. If you notice, at the top of outside.py, the file "system.py" was imported by the statement: "import system". This brings everything in the system.py file into your current file. Within system.py there is a font object declared [fnt=Font('main.fnt') - fnt being the object]. In the outside.py file you can access that object by entering "system.fnt" meaning the fnt object within the system file. This can be confusing at first but you'll soon understand. You can also access the player object that was made in system.py by entering "system.player" and so on. To make it even easier instead of "import system" you could do "from system import fnt" and be able to access that object by simply typing "fnt". The way tSB named the font object and imported system can be confusing to newbies who think it's a file :)
Posted on 2001-08-17 15:42:03
|
andy
|
Terribly sorry about that. I thought it was kinda funny, but I guess it's a bit confusing.
Rayner's right. It's an object called "fnt" in the system module. You can change the font itself by tweaking the font=Font('...') line in system.py, or by loading your own font object elsewhere and passing it instead. :)
"Ignorance is its own reward" -- Proverb
Posted on 2001-08-18 13:17:49
|