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

Re: [pygame] Pygame Render Text as Variables



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"