View Single Post
  #1  
Old 02-13-2011, 09:45 PM
dcnieho dcnieho is offline
Member
 
Join Date: Feb 2011
Posts: 59
CustomNode wrapping in python

Hi all,

(I'm using the Vizard 4.0 beta)

I'm trying to write a wrapper around a customnode plugin I created following the example in the SDK.
I'm new to Python however, and this is proving difficult.

I have the wrapper in a separate module, "DNstimuli.py" (this pretty much follows code for a sensor wrapper that I found on the forum):
Code:
import viz

class DNStimuli(viz.VizCustomChild):
	def testCall(self):
		self.command(1, 'TX')
		
viz.upgradeCustomNode('customnode',DNStimuli)

def addDNStimuli():
	return viz.add('customnode.dlc')
I then use it as follows:
Code:
import viz
from DNstimuli import addDNStimuli

viz.go()

custom = addDNStimuli()
custom.testCall()
This errors with:
Code:
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "C:\dat\C\projects\Vizard dll\quicktest.py", line 7, in <module>
    custom.testCall()
AttributeError: 'VizCustomChild' object has no attribute 'testCall'
What am I doing wrong / how do I do this cleanly? I want to keep my syntax simple and short in the main script, from what I think I've learned about Python, I therefore need to import the specific components from the module or I'll have to prefix everything by the module name.

Thank you for the advice and help in getting me started with this part of the job!

Best,
Dee
Reply With Quote