2009년 11월 14일 토요일

파이썬 URL 이미지 wxPython에 출력하기(print image from image by wxPython)


import wx
import urllib
class TestFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="LI")
p = wx.Panel(self)
data = urllib.urlopen("http://www.bigtravelweb.com/images/south_america_map_l.jpg")
img = wx.ImageFromStream(data, wx.BITMAP_TYPE_JPEG).ConvertToBitmap()
wx.StaticBitmap(p, -1, img, (10, 10), (img.GetWidth(), img.GetHeight()))

app = wx.PySimpleApp()
frm = TestFrame()
frm.Show()
app.MainLoop()

댓글 2개:

  1. http://blogs.sacbee.com/dining/banana__group_.jpg 의 경우 오류남

    답글삭제
  2. 파일로 저장했다가 파일로 읽어들이면 문제가 안됨. wx.ImageFromStream에서 error 남

    답글삭제