label's reference count goes to zero when the function exits,
and is thus destroyed

On Sat, Sep 10, 2011 at 7:10 PM, Aaron Richiger <a.ri...@bluewin.ch> wrote:
> Dear List!
>
> It looks very simple and I'm sure, there is a simple answer to my question,
> but I couldn't find anything in the doc why the following snippet is not
> showing a lable as expected. Of course it works, if the two "app..." lines
> are moved also into the function body, but if they are not in there, on my
> computer nothing is shown... I hope anybody can resolve my confusion,
> because I really can't explain me this behaviour...
>
> Thanks a lot and have a nice evening!
> Aaron
>
>
> import sys
> from PySide.QtCore import *
> from PySide.QtGui import *
>
>
> def showLabel():
>    label = QLabel("Hello World")
>    label.show()
>
>
> app = QApplication(sys.argv)
> showLabel()
> app.exec_()
>
>
> --
>
> Aaron Richiger
> Rosentalstr. 11
> 8400 Winterthur
>
> 079 613 71 78
>
> _______________________________________________
> PySide mailing list
> PySide@lists.pyside.org
> http://lists.pyside.org/listinfo/pyside
>
_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to