View Full Version : Python enumeration issues


The Great Apple
Apr 01, 2006, 03:42 PM
Firstly, as a disclaimer, I feel that the answer I'm looking for is probably staring me in the face... but I'm still looking for it.

I'm having trouble with a function. It wants to take an enumeration, but I want to iterate over the range of types, passing it an integer. Here is my code:

for i in range(YieldTypes.NUM_YIELD_TYPES):
plotYield = pPlot.getYield(i)
and here is my error:

ArgumentError
:
Python argument types in
CyPlot.getYield(CyPlot, int)
did not match C++ signature:
getYield(class CyPlot {lvalue}, enum YieldTypes)
Now I can't seem to figure out at the moment how to get it to pass the enumeration code for the yeild, rather than the actual number the code points to while keeping it generic enough to be able to handle additional yeildTypes.

Any ideas?

The Great Apple
Apr 01, 2006, 04:53 PM
Having fiddled around for a bit I've found making the code I'm doing is pretty damn hard to make generic. Not really needing an answer for this now, but it would be nice to get one anyway.

12monkeys
Apr 01, 2006, 05:52 PM
I remember having a similar problem with PanelStyles. I haven't found a solution and started to us integers instead of the constants.

No help here, sorry.

surt
Apr 01, 2006, 07:55 PM
for i in range(int(YieldTypes.NUM_YIELD_TYPES)):
plotYield = pPlot.getYield(i)


I seem to recall this being the code that worked for me in a similar situation.