1
I try to use cv2 with PyQt4 widget but I keep getting this error:
(python3:3974): GLib-GObject-WARNING **: 12:41:27.117: cannot register existing type 'GdkDisplayManager'
(python3:3974): GLib-CRITICAL **: 12:41:27.118: g_once_init_leave: assertion 'result != 0' failed
(python3:3974): GLib-GObject-CRITICAL **: 12:41:27.118: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
I am sure my cv2 code works fine
import cv2
def takePicture():
cap = cv2.VideoCapture(1)
while(True):
ret, frame= cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
but when I connect a button to it I get the previous error:
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
take_picture_button = QtGui.QPushButton('Take picture')
from takePicture import takePicture
take_picture_button.clicked.connect(takePicture)
take_picture_button.show()
- Ubuntu 18.04
- python3.6.7
- PyQt4 ?
- cv2 ?