|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Question on classes in Python I am currently working on python and I just met a case which I find hard to understand: Instance1 = class1 () Instance2 = Instance1.class2 () I adapted the trick (in fact it comes from panda 3D) My question: The 2nd row can really exist, if yes what is it (I do not understand the "Instance1.class2 ()") I specify my problem a little, giving you the original in Panda 3D Code: # Load the panda actor, and loop its animation pandaActor = Actor.Actor("models/panda-model",{"walk":"models/panda-walk4"}) pandaActor.setScale (0.005,0.005,0.005) pandaActor.reparentTo (render) pandaActor.loop ("walk") #Create the four lerp intervals needed to walk back and forth pandaPosInterval1= pandaActor.posInterval(13,Point3(0,-10,0), startPos=Point3(0,10,0)) pandaPosInterval2= pandaActor.posInterval(13,Point3(0,10,0), startPos=Point3(0,-10,0)) pandaHprInterval1= pandaActor.hprInterval(3,Point3(180,0,0), startHpr=Point3(0,0,0)) pandaHprInterval2= pandaActor.hprInterval(3,Point3(0,0,0), startHpr=Point3(180,0,0)) What I can not understand is: pandaPosInterval1 = pandaActor.posInterval (........) posInterval is also a class, I do not therefore: pandaActor.posInterval (........) Practically, this I have no problem, I understand the trick, but at the theoretical level (pure Python), I do not know what this is. |
#2
| |||
| |||
Re: Question on classes in Python look at the panda code ... But there is much chance that Actor.posInterval is a method that simply return an instance of a class named Interval . |
#3
| |||
| |||
Re: Question on classes in Python Thank you for your reply, but the doc panda3d (reference), posInterval is listed in the classes and not methods! Hence my interrogation! |
#4
| |||
| |||
Re: Question on classes in Python PosInterval != posInterval The case is important. I had a quick look on the doc panda3d and I did not find a method posInterval. Is the code that you gave run the latest version of panda? |
#5
| |||
| |||
Re: Question on classes in Python Sorry for the box, it is PosInterval, and it is well documented in the classes (nothing in the functions and nothing in the methods) when my interrogation this is what: instance2 = Instance1.class2 (... )? Also, this is the last version panda3D (software and doc) |
#6
| |||
| |||
Re: Question on classes in Python There is no "instance2 = instance1.class2 ()", it does absolutely nothing to say. There is just instance2 = instance1.method () |
![]() |
|
Tags: class, python |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about SanDisk sansa Clip Zip playlists question | VARIJ | Portable Devices | 8 | 27-01-2012 01:14 PM |
C # using classes in C + + | klite | Software Development | 3 | 01-10-2009 10:15 AM |
Classes in VB.NET | Samir_1 | Software Development | 2 | 10-04-2009 12:07 AM |
Download Python 3.0 / Python 3000 | Amaresh | Software Development | 6 | 24-02-2009 09:28 AM |