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?

Thanks!

-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Programming in Go" - http://www.qtrac.eu/gobook.html
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to