View Single Post
  #2  
Old 10-25-2009, 05:30 AM
IGoudt IGoudt is offline
Member
 
Join Date: Sep 2009
Posts: 20
I would do the following using a list, so that path1 is on index 0 and path n on index n-1

Code:
pathlist = list()

for curNumber in range(maxNumberOfPaths) :

     path = viz.add(viz.ANIMATION_PATH) 
     path.speed(1)
     path.loop(viz.CIRCULAR)
     pathlist.append(path)
The way to concatenate strings in Python is:

'text' + str(otherArgs)',

so 'path' + str(1) would become 'path1'

If you are unsure about the ability of the otherArgs to be casted correctly, you can wrap a try/catch around it.

If you want to call elements in a container by their name, you can use a dictionary.
Reply With Quote