I'm trying to open a namedWindow using openCV in raspberry pi but it freezes after cv2.namedWindow("image")line. However, the project works in Windows. Before it freezes it prints the following warnings:

(python3:959): GLib-GObject-WARNING **: 16:34:34.421: cannot register existing type 'GdkDisplayManager'

(python3:959): GLib-CRITICAL **: 16:34:34.421: g_once_init_leave: assertion 'result != 0' failed

(python3:959): GLib-GObject-CRITICAL **: 16:34:34.421: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
  • Are you sure that cv2.namedWindow("image") is enough to reproduce the problem? On an unrelated note, raspberry-pi-desktop doesn't run on RPi 4, it's a PC/Mac OS. You probably mean raspbian. – Dmitry Grigoryev Jul 8 '19 at 13:58


I am developing GUI with PyQt5.

I got error messages after running this code:

(python3:2306): GLib-GObject-WARNING **: 10:38:58.937: cannot register existing type 'GdkDisplayManager' (python3:2306): GLib-CRITICAL **: 10:38:58.938: g_once_init_leave: assertion 'result != 0' failed (python3:2306): GLib-GObject-CRITICAL **: 10:38:58.939: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

def SelectROI(self):

    #cv2.imshow("Select Region of Interest", self.browsed_img4)
    ImageToCrop = self.tmp_4.copy()

    r = cv2.selectROI(ImageToCrop)
     # Crop image

    imCrop = ImageToCrop[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]

The problem occurs when u are using different gtk version... For my case I was using gtk2 in QT configuration but in my machine I am using gtk3.


edit qt5ct.conf file

sudo nano /etc/xdg/qt5ct/qt5ct.conf
# replace style=gtk2 with style=gtk3
ctrl+x y ENTER

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.