Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Table Copy Method in Python

Discuss help and learning documents. Submit your ideas for future tutorials and documents

Table Copy Method in Python

Postby pdavila » Mon May 05, 2014 12:20 am

Hi,

The documentation on Python equivalents of Tscript methods for working with tables seems to have some misleading (or incorrect or incomplete?) info. To copy a table it suggests using:

Code: Select all
op('table1')['r1', 'c1'] = op('fromtable').copy()


I've tried this with no success but discovered that this works:

Code: Select all
op('targetTable').copy(op('sourceTable'))


This may be obvious for a more experienced Python user but it stumped me for while.

Thanks,

Patricio
pdavila
 
Posts: 7
Joined: Wed Dec 28, 2011 6:20 pm

Re: Table Copy Method in Python

Postby malcolm » Mon May 05, 2014 10:15 am

You are correct, fixed the entry. Sorry for the confusion.
User avatar
malcolm
Staff
 
Posts: 3856
Joined: Tue Nov 13, 2007 1:11 am

Re: Table Copy Method in Python

Postby pdavila » Mon May 05, 2014 5:04 pm

Great. Thanks for quick update!
pdavila
 
Posts: 7
Joined: Wed Dec 28, 2011 6:20 pm

Re: Table Copy Method in Python

Postby Timesquid » Thu Nov 05, 2015 6:46 pm

Does anyone know what one would do to make this function append the copyied rows to the end?

I cant get appendRows to work for many many rows at once.
Timesquid
 
Posts: 110
Joined: Wed Jan 04, 2012 8:08 pm

Re: Table Copy Method in Python

Postby raganmd » Thu Nov 05, 2015 9:20 pm

I think you might want to use a for loop to append lots of rows:

Code: Select all
for item in range( 63 ):
   op( 'table1' ).appendRow( [ item , item + 1 ] )
raganmd
 
Posts: 953
Joined: Thu Mar 28, 2013 5:21 am
Location: San Francisco, CA


Return to TouchDesigner Documentation

Who is online

Users browsing this forum: No registered users and 1 guest