def renew(self): ps = subprocess.Popen('xwd -root -display virgl-host:0'.split(), stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) output = subprocess.check_output(('xwdtopnm'), stdin=ps.stdout, stderr=subprocess.DEVNULL) ps.wait() f = io.BytesIO() f.write(output) f.seek(0) self.old = self.new img = Image.open(f) self.new = np.asarray(img) img.close() f.close() return()