[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Accessing global variables
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2012-08-24 15:26:24
Message-ID: 6528533ded6b5532af2ce0836b2e879f () localhost
[Download RAW message or body]

On Fri, 24 Aug 2012 14:26:10 +0200, Marco Meier <marco.meier@ifak.eu>
wrote:
> Hi,
> 
> i am trying to access an enum that is defined globally in a namespace.
> Simply defining it in the sip file wraps the type correctly, but the
> value is not the one in the c++ shared object.
> 
> I tried to use %SetCode and %GetCode with an integer to access the
> correct value. %GetCode works as intended. But when setting the value
> e.g. with module.enuminstance = 2, the %SetCode is not called, but a new
> integer object is assigned to module.enuminstance. What is the correct
> way to modify this global enum?

Python doesn't allow you to do what you want. Specifically, module
attributes don't support the descriptor protocol.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic