Coverage for hypergan/pygame_viewer.py : 40%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
""" Opens a window that displays an image. Usage:
from viewer import GlobalViewer GlobalViewer.update(image)
"""
image = np.transpose(image, [1, 0,2]) size = [image.shape[0], image.shape[1]] if not self.screen: import pygame self.pg = pygame self.screen = self.pg.display.set_mode(size) self.pg.display.set_caption(self.title) self.pg.event.get() surface = self.pg.Surface(size) self.pg.surfarray.blit_array(surface, image) self.screen.blit(surface, (0,0)) self.pg.display.flip()
|