Discussion:
[comtypes-users] Question: Enums in getModule(tlib)
Rise Riyo
2014-10-10 16:08:33 UTC
Permalink
Hi, all,

I am new to comtypes, and have a question about how a COM type library is
generated as code in the comtypes/gen directory. I have been looking at the
files, codegenerator,py, tlbparser.py and the method, getModule(tlib).

I would like to know if it is possible to access the enums of a component
of an medical instrument in an another way other than how it is generated
in the code in comtypes/gen directory.

For example,
# values for enumeration 'ProjectionMode'
pmImaging = 1
pmDiffraction = 2
ProjectionMode = c_int # enum

to something like:
class ProjectionMode(Enum):
pmImaging = 1
pmDiffraction = 2
ProjectionMode = c_int # enum

I fiddled around with the code in codegenerator.py but I was unable to
access the enums as in:

client.comtypes.gen._BC0A.....ProjectionMode.pmImaging

Does anyone have suggestions? Thanks well in advance. - Rise
--
Ms. Rise Riyo
*********************************************************************
“Named must your fear be before banish it you can.” - Yoda
Loading...