[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Pygame Render Text as Variables
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Pygame Render Text as Variables
- From: "Ian Mallett" <geometrian@xxxxxxxxx>
- Date: Fri, 5 Oct 2007 10:18:14 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 05 Oct 2007 13:18:25 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ffeM2ROZxc7dHSdo0jCSXltoU52SX+ibFdh1F5Pl6NU=; b=U4NUsW7vVzjCnp98O4X9589lBve9dG97LlMChcsldzvDUStIWz90xx4kiE7SUtAxKBxphZVMlKGxh2KOUJDEQR44lKezWa5YjDKbqXXO/CiJQseJNYhAoMHo8GyS4HrBN5feTzCx2dlabODe/CbAvh0e5dHQMSaHBQFzY/d6hNQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oxbpiaE0qaQvq39vhPNRxnodUhdu8rMX3Qe0IXrJZdy6sacJBn91J49DB28PnMKGAH/DKNdZtF2f6mSs0408cggpur98agTHBekiAWUXUicpz6qt1kh/z3Davkyx+s6mdB66Pk/EhiSzhwJoW/OTyFs7TB53ixqZKtL3VAng/vw=
- In-reply-to: <470654EA.9050508@xxxxxxxxxxxxx>
- References: <470654EA.9050508@xxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Do you mean like:
1=a, 2=b, 3=c...
my_string = (3,1,2)
It seems simpler to assign a variable to a string. That's easy:
my_string = "cab"
Then you can feed that variable into the font.render() function, and
it will work fine. If you want to render just the first or last
letters, use slice notation. Something like:
my_string = "Python"
first_letter = my_string[0]
last_letter = my_string[:0]
# first_letter == "P", last_letter == "n"