[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] font/text in pygame
- To: pygame-users@xxxxxxxx
- Subject: [pygame] font/text in pygame
- From: "D. Hartley" <denise.hartley@xxxxxxxxx>
- Date: Tue, 26 Apr 2005 15:57:51 -0700
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 26 Apr 2005 18:58:24 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=N2cIIfdvElTPKFDd1Cyq5X++Pylwfac42cDcQlEABrBX4DPWzTBynCppHWqjNlXRNCme660LWgzoalQy1mef3dX2mXOVZAuj6NaK78xJEVkL2xsdM8MLby/IT66QtViso/WHmLKsQHD1XgykcZ580/Q0eTb+9AVBQJtMVWX9/Mc=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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