wxPython: images from URLs

Tim Roberts timr at probo.com
Fri Jan 30 05:24:04 CET 2004


Jonathan Daugherty <cygnus at cprogrammer.org> wrote:

># self._imgstream = urllib2.urlopen(url).read()
># stream=cStringIO.StringIO(self._imgstream)
># 
># try:
>#    img=wxImageFromStream(stream)
># except:
>#    pass
>
>I have tried this and it appears to work, but once I have
>the image (from wxImageFromStream), I use it as follows:
>
>try:
>    bm = wxBitmap(img)
>    self.bitmap.setBitmap(bm)
>except Exception, e:
>    print e

Why wouldn't you use wxBitmapFromImage?
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list