Good day,
I've been mucking around with PIL 1.1.2, VideoCapture .8beta, and
wxPython 2.3.3.1 to attempt to produce an encrypted webcam server/client
(as there are none available that I could find).
Now, I've got the beast working. Sockets are good. GUI is good.
Everything works...except that image display is somewhat quirky. That
is, when I use wxStaticBitmap.SetBitmap(image), over the course of a few
drawings, it seems to be continually layering the static bitmaps on top
of each other...ad infinitim (I can tell because I get an animation at
graphics card speed of allthe images ever there). After around 30 or so
updates, even after stopping future updates, moving the window takes
ALOT of processor as one tries to drag the window around. It keeps
redrawing every image that used to be within the static bitmap.
Right now I'm using the wxPanel subclass given at the end. My concern is
but the (currently) four lines:
try:
self.image.SetBitmap(image_as_stringio)
except:
self.image = wxStaticBitmap(self, -1, self.GetBitmap(image_as_stringio),(0,0))
For updating a bitmap on the screen, which will be updating every .5-10
seconds, for possibly hours/days/more, what is the proper way for having
a bitmap that gets updated on the screen without saving any old
information?
Thank you,
- Josiah Carlson
class ImagePanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)
self.Disp_Image_F('startup.jpg')
def GetBitmap(self, image_file):
source = Image.open(image_file, 'r')
image = apply( wxEmptyImage, source.size )
image.SetData( source.convert( "RGB" ).tostring() )
return image.ConvertToBitmap()
def Disp_Image_S(self, image_as_stringio):
try:
self.image.SetBitmap(image_as_stringio)
except:
self.image = wxStaticBitmap(self, -1, self.GetBitmap(image_as_stringio), (0,0))
#print dir(self.image)
def Disp_Image_F(self, filename):
fl = open(filename, 'rb')
data = StringIO(fl.read())
fl.close()
self.Disp_Image_S(data)