def update(self):
        if self.enabled:
            try:
                # Read the length of the image as a 32-bit unsigned int. If the
                # length is zero, quit
                image_len = struct.unpack('<L', self.connection.read(4))[0]
                if not image_len:
                    print "Could not read image length. Skipping.."
                    self.enabled = False
                    return
                print("Image length: %s" % image_len)
                # Construct a stream to hold the image data and read the image
                # data from the connection
                image_stream = io.BytesIO()
                image_stream.write(self.connection.read(image_len))
                # Rewind the stream, open it as an image with PIL and do some
                # processing on it
                image_stream.seek(0)
                # this part is from the previous version of this.
                # let's see how it integrates with the new code
                # img = wx.ImageFromStream(StringIO(image_stream))
                img = wx.ImageFromStream(image_stream)
                bmp = wx.BitmapFromImage(img)
                ctrl = wx.StaticBitmap(self, -1, bmp)
                # image = Image.open(image_stream)
                # print('Image is %dx%d' % image.size)
                # image.verify()
                # print('Image is verified')
            except Exception, e:
                print("Exception: %s, closing client" % e)
                self.shut_down()
Update panel with new image.
dataset/ETHPy150Open FishPi/FishPi-POCV---Command---Control/fishpi/ui/camera_view.py/CameraPanel.update