[PyQt] os X unexpected quit message

GiForce code at hispeed.ch
Fri Nov 4 06:43:02 GMT 2016


hello

I’m new into pyqt5 and going through the basics. I recieve an „unexpected quit“ alert in the following situations:
a mousePressEvent with an pyqtSignal object .emit() either self.close or QApplication.instance().quit resulting in the os x alert. First it seems to properly proceed and quit, but after a moment the alert pops up. Same output via Qwidget or QMainWindow root object. Terminal output> Abort trap: 6
opening QColorDialog.getColor() and returning the color to a QFrame. Running time this works, multiple times. But when closing the application (red button or cmd-Q) results in the os x alert. While terminal> Segmentation fault: 11.
 Here the code of the QColorDialog, so you see how I build the app:


import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QFrame, QColorDialog
from PyQt5.QtGui import QColor

class Example(QWidget):

    def __init__(self):
        super().__init__()

        self.initUI()


    def initUI(self):

        col = QColor(0, 0, 0)

        self.btn = QPushButton('Dialog', self)
        self.btn.move(20, 20)
        self.btn.clicked.connect(self.showDialog)

        self.frm = QFrame(self)
        self.frm.setStyleSheet("QWidget {{ background-color: {} }}".format(col.name()))
        self.frm.setGeometry(130, 22, 100, 100)

        self.setGeometry(300, 300, 250, 180)
        self.setWindowTitle('From here to color dialog')

        self.show()


    def showDialog(self):

        col = QColorDialog.getColor()

        if col.isValid():
            self.frm.setStyleSheet("QWidget {{ background-color: {} }}".format(col.name()))


if __name__ == '__main__':

    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())




Any suggestions? Need to dig into the os-x alert error-report?

Many many thanks in advance! I really started to like pyqt, after using tkinter for a while :)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161104/1105fa60/attachment.html>


More information about the PyQt mailing list