Ver Mensaje Individual
  #13 (permalink)  
Antiguo 28/06/2010, 04:49
Avatar de Bosc
Bosc
 
Fecha de Ingreso: marzo-2010
Mensajes: 43
Antigüedad: 14 años, 9 meses
Puntos: 3
Respuesta: Abrir un archivo Fantasma

Bueno pues con wxPython al final me ha salido asi:

Código Python:
Ver original
  1. import wx,cStringIO,base64
  2.  
  3. b64_jpg = \
  4. """/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAASUkqAAgAAAAEABoBBQABAAAAPgAAABsBBQAB
  5. AAAARgAAACgBAwABAAAAAgAAADEBAgARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABAAAAQm9zYyBQ
  6. eXRob24gSi5MLgD//9sAQwAXEBEUEQ4XFBIUGhgXGyI5JSIfHyJGMjUpOVJIV1VRSFBOW2aDb1th
  7. fGJOUHKbc3yHi5KUklhtoKyfjqqDj5KN/9sAQwEYGhoiHiJDJSVDjV5QXo2NjY2NjY2NjY2NjY2N
  8. jY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2N/8AAEQgATgBNAwEiAAIRAQMRAf/E
  9. AB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE
  10. EQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH
  11. SElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1
  12. tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB
  13. AQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXET
  14. IjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVV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5qyXky7QcmNRnI+tas+gabLD5YtgnGAycEf4/jWpRQBwd5ot9ZXu2CGaVV
  29. IZJEjJ/l3rtLbzmtozOuJSo3getWKKAI8H0NSUUUAFFFFAH/2Q==
  30. """
  31.  
  32. jpg_ = base64.b64decode(b64_jpg)
  33.  
  34. class jpg(wx.Frame):
  35.     def _init_ctrls(self, parent):
  36.        
  37.         wx.Frame.__init__(self, id=-1, name='', parent=parent,pos=(472, 231), size=(100,150))
  38.                        
  39.  
  40.     def __init__(self, parent):
  41.         self._init_ctrls(parent)
  42.         stream1 = cStringIO.StringIO(jpg_)        
  43.         foto = wx.BitmapFromImage(wx.ImageFromStream(stream1))        
  44.         wx.StaticBitmap(self, -1,foto)
  45.  
  46.  
  47. if __name__ == '__main__':
  48.     app = wx.PySimpleApp()
  49.     frame = jpg(None)
  50.     frame.Show()
  51.  
  52.     app.MainLoop()

Funciona ! El codigo muestra una imagen que no existe en disco.

Última edición por Bosc; 29/06/2010 a las 14:34