System.CreateObject

New releases and general discussions.

Post » Fri Aug 14, 2009 11:02 pm

[code:1ux2mmzi]System.CreateObject(LGPGuiWindowProfile,0,400,300)[/code:1ux2mmzi]
Gives me the error "NoneType object is not callable"
:(
B
3
S
1
G
3
Posts: 49
Reputation: 1,148

Post » Sat Aug 15, 2009 6:48 am

Hmm, is that the "create object by name" expression? I'm guessing you might have to put the object name into quotation marks (" ").

Just a wild guess. Don't kill me if it doesn't work ;)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Aug 15, 2009 8:48 pm

Yeah you'd need to put quotations round the object name you want to create.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Aug 18, 2009 12:22 am

Still happens. I've tried all the create object functions, no go. Same error message for all of them.
B
3
S
1
G
3
Posts: 49
Reputation: 1,148

Post » Sun Nov 08, 2009 4:57 pm

Same problem for me, and i don't know how to figure out.
B
1
G
3
Posts: 1
Reputation: 827

Post » Fri Jan 29, 2010 3:02 pm

Did anyone get this working? I want to create a sprite dynamically from Python but I'm getting the same error as Zack0.

I have a sprite object on the layout named Sprite.
In Python I have the following code - System.CreateObject(Sprite, 1, 50, 50)

I've also tried - spr = System.CreateObject(Sprite, 1, 50, 50) , in case it returns the object created or something. I've even tried CreateObjectByName with quotations.. nothing works. Any ideas?
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Jan 29, 2010 7:30 pm

I've never been able to get it to work. What I do instead is make a Function object that calls CreateObjectByName and then call the function from Python.
B
1
G
2
Posts: 1
Reputation: 627

Post » Fri Jan 29, 2010 8:32 pm

You need to remove "Object" from it. So it would be for example:[code:2hafnbcs]System.Create("Sprite",1,50,50)[/code:2hafnbcs]
B
79
S
24
G
54
Posts: 4,751
Reputation: 40,765

Post » Fri Jan 29, 2010 8:50 pm

Was just about to reply to JUK saying his method wasn't working and noticed ROJO's, so thought I'd give that a try before I replied. IT WORKED! Nice one man. Bit weird that it's Create(), as that's not listed in the Functions list box on the right in the Python editor. Ah well..

Cheers for replying too JUK. Would still like to know your method as I'd probably find it useful to call a Construct Function from within Python... nothing I tried worked.

eg. Construct -> On Function "blah"

Python -> blah()

Doesn't work..
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Fri Jan 29, 2010 9:31 pm

All the create functions are incorrectly listed:
System.CreateObject -> System.Create
System.CreateObjectAtObject -> System.CreateAtObject
System.CreateObjectByName -> System.CreateByName
System.CreateObjectIP -> System.CreateIP

As to calling a construct function from python you would do something like this:
[code:3nywgwkf]Function.ClearParams()
Function.AddParam(50)
Function.Call("blah",0)[/code:3nywgwkf]
B
79
S
24
G
54
Posts: 4,751
Reputation: 40,765

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests