Importing an external library?

For questions about using Classic.

Post » Sat Jan 15, 2011 8:13 pm

I would like to use NumPy in my project, how would I go about importing it, into construct?

EDIT: While I'm here, also is there a direct way to import an array from my pyscript into a Construct array?
B
5
S
2
G
3
Posts: 36
Reputation: 1,622

Post » Sat Jan 15, 2011 11:38 pm

[quote:1jkn8tl5]I would like to use NumPy in my project, how would I go about importing it, into construct?[/quote:1jkn8tl5]
Scidave has a guide how to do it:
[url:1jkn8tl5]http://www.scirra.com/forum/viewtopic.php?f=8&t=5920&hilit=python+external+libraries[/url:1jkn8tl5]
Just adapt it to NumPy.

[quote:1jkn8tl5]EDIT: While I'm here, also is there a direct way to import an array from my pyscript into a Construct array?[/quote:1jkn8tl5]
For a one-dimensional array:
[code:1jkn8tl5]MyArray = [1,2,3,4,5,6]

Array.SetSize(len(MyArray),1,1)

for i in range(Array.SizeX):
Array.SetAtX(i+1,MyArray[i])[/code:1jkn8tl5]
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sun Jan 16, 2011 1:10 am

Sorry, I forgot to mention it's a 2D array. (Using NumPy's "ones" function). And thank you for the guide!
B
5
S
2
G
3
Posts: 36
Reputation: 1,622


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests