[PySide] PyInstaller Main Window Duplicating Infinitely (Win 10)
paul basinger
paulcb213 at gmail.com
Thu Sep 5 14:46:52 CEST 2019
Hi Israel,
That fixed it. Thank you!
Paul
On Wed, Sep 4, 2019 at 5:58 PM Israel Brewster <ijbrewster at alaska.edu>
wrote:
> On Sep 4, 2019, at 1:52 PM, paul basinger <paulcb213 at gmail.com> wrote:
>
> Hello,
>
> After making an exe from pyinstaller, the code below causes the main
> window to duplicate repeatedly. I haven't tried it with QProcess yet but I
> started looking into it. Anyone know python's multi-processes equivalent in
> PySide2/QT. It runs fine when run normally with python (3.7).
>
> Thanks,
>
> Software Engineer
> Paul Basinger
> paulcb213 at gmail.com
>
>
> Try adding, at the very beginning (before you do any PySide2 imports):
>
> from multiprocessing import freeze_support
>
> I want to say that’s what fixed this for me. It’s fine to import this even
> when not frozen, but it should fix things when using pyinstaller.
> ---
> Israel Brewster
> Software Engineer
> Alaska Volcano Observatory
> Geophysical Institute - UAF
> 2156 Koyukuk Drive
> Fairbanks AK 99775-7320
> Work: 907-474-5172
> cell: 907-328-9145
>
>
> import sys
> import threading
> import random
> from PySide2.QtWidgets import QApplication, QLabel
> from PySide2.QtCore import QThread
> from multiprocessing import Process, Queue, Manager
>
> def hello(q):
> q.put(1)
>
> class AppThread(QThread):
> def __init__(self, parent):
> super(AppThread, self).__init__(parent)
>
> def run(self):
> self.loadApp()
>
> def loadApp(self):
> q = Queue()
> p = Process(target=hello, args=(q,))
> p.start()
> q.get(timeout=1)
> p.join()
>
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> label = QLabel("Hello World")
> label.show()
> thread = AppThread(app)
> thread.start()
> sys.exit(app.exec_())
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> https://lists.qt-project.org/listinfo/pyside
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20190905/6aeb1d82/attachment.html>
More information about the PySide
mailing list