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

Re: [pygame] How the get a font size



James Paige wrote:
On Mon, Jan 12, 2009 at 04:54:38PM -0800, Lenard Lindstrom wrote:
Hi,

James Paige wrote:
[snip]
f.pointsize = 12
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: 'pygame.font.Font' object has no attribute 'pointsize'

I'm guessing that since pygame.font.Font is impelmented in C, it doesn't allow new members to be added as it would if it was implemented in python (Correct me if I am wrong)

You're right. Font instances lack attribute dictionaries. It was a design decision, or omission, and not a restriction of Font being implemented in C.


Ah, interesting. I stand corrected.

Why was the attribute dictionary left out? What is the advantage? Is it a performance thing?

Basically to save memory. It is also easy to overlook when coding a new extension type.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>