All pastes #230605 Raw Edit

Mine

public text v1 · immutable
#230605 ·published 2006-10-31 10:28 UTC
rendered paste body
#!/usr/bin/python

import urllib
from wxPython import wx
from wxPython.wx import wxImageFromStream, wxBitmapFromImage
from cStringIO import StringIO
import wx

url = 'http://www.welikesheep.com/archives/lucyliu.jpg'

class MyImage(wx.Image):
	fp = urllib.urlopen(url)
	data = fp.read()
	fp.close()
	img = wx.ImageFromStream(StringIO(data))

class MyFrame(wx.Frame):
     def __init__(self, parent, id, title):
         wx.Frame.__init__(self, parent, id, title, size = (640,480))
	 self.bitmap=wxBitmapFromImage(MyImage.img)
         wx.EVT_PAINT(self, self.OnPaint)
         self.Centre()

     def OnPaint(self, event):
         dc = wx.PaintDC(self)
         dc.DrawBitmap(self.bitmap, 60, 20)

class MyApp(wx.App):
     def OnInit(self):
         frame = MyFrame(None, -1, 'CamView')
         frame.Show(True)
         self.SetTopWindow(frame)
         return True
     
 
app = MyApp(0)
app.MainLoop()