1 """Debugging image display.
3 This is a simple module, that shows images on screen using PyGame.
4 It is not used anywhere in the standard UI, serves only for debugging.
9 except ImportError, msg:
11 print >>sys.stderr, msg
14 def show(image, caption='', name=None):
15 """Initialize PyGame and show the *image*."""
16 if image.mode != 'RGB':
17 image = image.convert('RGB')
20 caption = "Imago: " + caption
23 pygame.display.set_caption(caption)
24 pygame.display.set_mode(image.size)
25 main_surface = pygame.display.get_surface()
26 picture = pygame.image.frombuffer(image.tostring(), image.size, image.mode)
27 main_surface.blit(picture, (0, 0))
28 pygame.display.update()
30 events = pygame.event.get()
32 if event.type == pygame.QUIT or event.type == pygame.KEYDOWN: