<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 25/09/2015 00:08, Reinder Feenstra a
écrit :<br>
</div>
<blockquote
cite="mid:CAD_NXMX8e1wdm43n04rK7ePsaFU41JcNtnrV29AJhRn7BcAA2g@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>Dear Readers,<br>
<br>
</div>
I've an issue with creating dialogs in an
other file than the QApplication,<br>
I created two tests to show the problem:<br>
<br>
</div>
== dialog_test_1.py<br>
import sys<br>
from PyQt4.QtCore import *<br>
from PyQt4.QtGui import *<br>
<br>
app = QApplication(sys.argv)<br>
<br>
dialog = QDialog()<br>
dialog.show()<br>
<br>
sys.exit(app.exec_())<br>
<br>
</div>
</div>
== dialog_test_2.py<br>
import sys<br>
from PyQt4.QtCore import *<br>
from PyQt4.QtGui import *<br>
import dialog_test_2_utils<br>
<br>
app = QApplication(sys.argv)<br>
<br>
dialog_test_2_utils.create_and_show_dialog()<br>
<br>
sys.exit(app.exec_())<br>
<br>
== dialog_test_2_utils.py<br>
from PyQt4.QtCore import *<br>
from PyQt4.QtGui import *<br>
<br>
def create_and_show_dialog():<br>
dialog = QDialog()<br>
dialog.show()<br>
<br>
</div>
dialog_test_1 works as expected<br>
dialog_test_2 doesn't show the dialog, why?<br>
<br>
</div>
I don't understand why it makes a difference when the
dialog is created and shown in another file.<br>
<br>
</div>
<div>System info:<br>
</div>
<div>OS: Kubuntu 15.04 (amd64)<br>
</div>
Python: 2.7.9<br>
</div>
PyQt4: 4.10.4<br>
<br>
</div>
Best regards,<br>
</div>
Reinder</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
<br>
<br>
Maybe because when python exit the function create_and_show_dialog()
the dialog is garbage-collected ?<br>
<br>
Vincent<br>
</body>
</html>