On Thu, Mar 10, 2011 at 1:20 PM, Mark Summerfield <[email protected]> wrote:
> Hi,
>
> In PyQt you can write an isAlive() function like this:
>
>
>    def isAlive(qobj):
>        import sip
>        try:
>            sip.unwrapinstance(qobj)
>        except RuntimeError:
>            return False
>        return True
>
> You can then ask about a top-level window,
>
>    if isAlive(aWindow): ...
>
> which is useful for SDI applications when a top-level window might have
> been deleted (e.g., closed by the user) while you still have a reference
> to it (e.g., a list of open windows).
>
> How d'you check whether an object reference refers to a real existing
> object in PySide?
>

There was a thread[1] on this subject some time ago but currently (as
of 1.0) there is no direct way of asserting whether an object is valid
or not.

[1] http://lists.pyside.org/pipermail/pyside/2010-December/001572.html

-- 
Lauro Moura
INdT - Instituto Nokia de Tecnologia
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to