On Apr 26, 2005, at 23:57, D. Hartley wrote:

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 :)

The idea, of course, is to convert the things you want to display to strings. You may be interested in the following things:


- the str() function -- converts anything it's passed into a string. str(1) returns "1". str((2, 3, 4)) returns "(2, 3, 4)".
- Basic string concatenation -- use the + operator. Example: "a" + "b" returns "ab".
- the string.join method -- joins a list or tuple of strings. Example: 'xx'.join(["foo", "bar", "baz"]) returns "fooxxbarxxbaz".
- string formatting. You ever programmed in C? It's basically the same thing as printf, only better. Example:
"Hi, my name is %s. I am %s years old. I come from %s." % ("Max", 21, "France")
returns "Hi, my name is Max. I am 21 years old. I come from France."


By using some of these (string formatting and str() come to mind), you should be able to do what you want.

Hope that helps,
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?"


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to