Python Forum
error 'ring' is not a callable object
Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error 'ring' is not a callable object
#1
I'm trying to get the ball to fly through a series of rings, but I keep getting this error message 'ring' is not a callable object.  The strange thing is when I run the code, I get a single ring and two spheres. I'm guessing it has to do with the way it's set up in the loop, but I don't know why the ring would be any different than the sphere.  
Thanks

from visual import *

myuniv = display(range=vector(6,6,6))

s = vector(0,1.1,0)
v = vector(9.5,0,0)
a = vector(0,-9.8,0)

t = 0.0
dt = 0.05

ball = sphere(pos=s,radius=.3,color=color.cyan)

while s.y > -.2:
    s = s + v*dt
    print ('s=',s)
    v = v + a*dt
    t = t + dt
    ball.pos = s
    ballghost = sphere(pos=s,radius=.2)
    ring = ring(pos=s,axis=v,radius=1.0,color=color.red)
Reply
#2
(May-02-2017, 04:45 AM)JakeWitten Wrote:
    ring = ring(pos=s,axis=v,radius=1.0,color=color.red)

You're getting one ring, and then an error, because the first time through the loop you call ring()... and then overwrite the "ring" function by assigning something to the variable. Rename your variable (or just don't assign ring()'s output, since you don't use it anyway), and it might work.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  getting an error"Line 7: TypeError: 'int' object is not callable" JTNA 4 7,198 Apr-03-2019, 01:58 PM
Last Post: JTNA
  Integer object error Zatoichi 2 3,690 Feb-18-2018, 07:25 AM
Last Post: Zatoichi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020