Python question. I think

pholtz

King
Joined
May 2, 2006
Messages
672
Location
Seattle
I am looking at how events are handled in the normal code and some of the mods. I am new to python and trying to understand the syntax.

Looking at the following file

CvEventInterface

The line:

normalEventManager = CvEventManager.CvEventManager()

I assume is instancing the Event Manager, but when I look in the CvEventManager class definition, I see lots of variables (attributes) and methods but none named CvEventmanager.

I'll go out on a limb here and guess that this is a python standard and that when a class in instanced with

classobj = className.className()

that the __init__ function is called?

This wasn't discussed in the tutorial I did, I'll head off to the python website and see if I can find the answer. But any help here would be appreciated.
 
pholtz said:
I am looking at how events are handled in the normal code and some of the mods. I am new to python and trying to understand the syntax.

Looking at the following file

CvEventInterface

The line:

normalEventManager = CvEventManager.CvEventManager()

I assume is instancing the Event Manager, but when I look in the CvEventManager class definition, I see lots of variables (attributes) and methods but none named CvEventmanager.

I'll go out on a limb here and guess that this is a python standard and that when a class in instanced with

classobj = className.className()

that the __init__ function is called?

This wasn't discussed in the tutorial I did, I'll head off to the python website and see if I can find the answer. But any help here would be appreciated.
classobj = moduleName.className()

Yes, __init__ is called.
 
Ah, thank you both. Learned 2 things for the price of one. I was a bit confused with CvEventManager.CvEventManager, thinking the first one was the class name. If the first one is the module name it makes sense. And also nice to know that __init__ is called.
 
Back
Top Bottom