[PyKDE] Wrapped classes with sip: how sip/python does handle enums ?

Phil Thompson phil at riverbankcomputing.co.uk
Thu Dec 16 14:00:04 GMT 2004


> Dear all,
>
> I've a class with a public enum:
>
> class Mode
> {
> public:
>     enum FileSelectMode { openFolder, openFile, saveFile };
>     ....
> };
>
> I've another class which ctor takes this enum as argument:
>
> class FileSelect
> {
> public:
>     FileSelect( Mode::FileSelectMode mode );
>     ....
> };
>
> I've wrapped the two classes with sip, it builds ok.
>
> I can create in Python a FileSelect like this:
> fs = FileSelect( 2 )
>
> How can I use the enum values instead of the numeric value ?
> ie: in C++ this would be  fs = FileSelect( Mode::openFile );
> In python... ?

fs = FileSelect(Mode.openFile)

Phil




More information about the PyQt mailing list