I'm learning to use pyqt5
and qt designer
and I am so confused.
My goal is show a picture when I click a push button because in a future I want to combine all of this with opencv
.
Now I have a window with a push button and an image (it is a label).
Code of the conversion from .ui
to .py
:
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
# Omitted code
self.pushButton.clicked.connect(self.imagen)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "PROG PRUEBAS QT"))
self.pushButton.setText(_translate("MainWindow", "Escala de grises"))
self.label.setText(_translate("MainWindow", "<html><head/><body><p><img src=\":/chchch/img.png\"/></p></body></html>"))
#
def imagen(self):
img = cv.imread('img.png', 0)
cv.imshow('sss', img)
cv.imwrite('pichi.png', img)
#
import noe_rc
But now, when I run it with my Pycharm, it crashes in the import noe_rc
. And if I commented, the image doesn't appear.
PS: If I comment the import the imagen
function works well but the image appears in a new windows.