[PyKDE] enum arguments in sip
    Jim Bublitz 
    jbublitz at nwinternet.com
       
    Wed Sep 10 17:51:01 BST 2003
    
    
  
On Wednesday September 10 2003 00:30, Patrick Stinson wrote:
> I've been using sip to generate python bindings for my lib,
> but ran into a problem with passing an enum to a member
> method.
> sip file:
> ----------------------
> public:
>   enum ModuleType
>   {
>     Module,
>     Producer,
>     Consumer
>   };
>   static void AddModule(PK_Module *, ModuleType);
> header file:
> ------------------------
> public:
>
>   enum ModuleType
>   {
>     Module,
>     Producer,
>     Consumer
>   };
>
>   PK();
>
> python code:
> -------------------------
> PK.AddModule(po, PK.Producer)
>
> python exception:
> -------------------------
>
> Traceback (most recent call last):
>   File "test.py", line 18, in ?
>     t.slotLoad("/home/ajole/track.wav")
>   File "/usr/home/ajole/src/pksampler/pksampler/Track.py",
> line 514, in slotLoad
>     PK.AddModule(po, PK.Producer)
> TypeError: Argument 1 of PK.AddModule() has an invalid type
Try changing this:
    static void AddModule(PK_Module *, ModuleType);
to this:
    static void AddModule(PK_Module *, PK::ModuleType);
sip usually wants fully qualified (nested) names for all 
references.
Jim
    
    
More information about the PyQt
mailing list