View Single Post
  #1  
Old 11-19-2012, 04:39 PM
tokola tokola is offline
Member
 
Join Date: Nov 2012
Posts: 67
Question 'module' object is not callable???

Hi there.
I am trying to do something seemingly simple. I want to have an avatar (steve) attached to different views and I am using the roboChase code in my own Player class (shown below). The class works fine if I run it but not when used as a module. More specifically, when I try to create a new Player object (p1=Player(viz.MainView)) then I get the following error:
Code:
Traceback (most recent call last):
  File "<string>", line 2, in <module>
TypeError: 'module' object is not callable
Can you please let me know what is the problem? The error message is kind of cryptic! Also, is there a better way to do the same thing, like linking the avatar with the viewpoint (and avoiding the view through the robot's head)?

Code:
import viz
import steve

class Player():
	"""This is the Avatar class"""
	def __init__ (self, view):
		self._view = view
		self._player_matrix = viz.addGroup() #self.view.getMatrix()
		self._avatar = steve.Steve()
		self._avatar.setTracker(self._player_matrix)
		self._updateFunc = vizact.onupdate(0, self.Update)
		
	def UpdatePlayer(self):
		pos = self._view.getPosition(viz.VIEW_ORI)
		quat= self._view.getQuat(viz.VIEW_ORI)
		self._player_matrix.setPosition(pos)
		self._player_matrix.setQuat(quat)
		
	def Update(self):
		vizact.ontimer(0, self.UpdatePlayer)
Reply With Quote