[Tutor] font/text in pygame
D. Hartley
denise.hartley at gmail.com
Wed Apr 27 00:57:39 CEST 2005
So with pygames, if I want to display text on the graphics window, I
can set the font and size and so on, and set what I want my text to
be. But if I wanted python to grab that text from a list, say, how
would I do that? I can do it in the print command, as follows:
for score, name in high_scores:
slip = 30 - len(name)
slip_amt = slip*" "
prefix = 5*" "
print prefix,name,slip_amt,score
(slip et al. is spacing stuff - not the prettiest code to do it, but it works)
But in any case, font/text will only take strings - i cant pass in a
list, or an index to an item in a list (which is, in this case, a
tuple), and since the items in the list will be changed and updated
obviously i cant just type in the items as strings myself.
any ideas? does this question even make sense the way it's worded?
It's a last-ditch effort to get my high score list onto the graphics
window before i have to abandon it :)
Thanks!
~Denise
More information about the Tutor
mailing list