Why don't you use c_uint for the enum parameter and then use such a mapping (enumerations usually represent unsigned integer values):
in C:
typedef enum { MY_VAR = 1, MY_OTHERVAR = 2 } my_enum_t;
and in Python:
class MyEnum(): __slots__ = ('MY_VAR', 'MY_OTHERVAR') MY_VAR = 1 MY_OTHERVAR = 2 myfunc.argtypes = [c_uint, ...]
Then you can pass the MyEnum fields to the function.
If numbered values โโrequire a string representation, you can use dictionary in the MyEnum class.
source share