I have created a minimal example with pyqt designer, that changes the text of a label when a button is pressed and is supposed to present a screenshot in the window, via the
"screenshot" shares the same memory with "qimg", and as screenshot it is a local variable that when eliminated the associated memory is also eliminated so the QPbelmap of the QLabel when trying to access information will generate a Segmentation fault. The solution is to make a copy so that they do not share the same memory
def take_screenshot(self):
screenshot = grab()
qim = ImageQt(screenshot).copy()
pix = QtGui.QPixmap.fromImage(qim)
self.label.setPixmap(pix)
self.label.adjustSize()