how to make python socket server work with the app.MainLoop() in wxpython?

zxo102 zxo102 at gmail.com
Tue Aug 8 10:30:35 EDT 2006


Dennis:

Thanks for your message. Let me try the double-buffer-operation.

Ouyang
Dennis Lee Bieber wrote:
> On 1 Aug 2006 01:10:18 -0700, "zxo102" <zxo102 at gmail.com> declaimed the
> following in comp.lang.python:
>
> >
> > I just wrote the code following the example you provided. The image
> > location can be controlled with the data from socket client. But only
> > one thing confuse me. When the image keeps moving to a new location,
> > the image at a "old" location is not deleted and  is left behind in the
> > frame. Do you know what is going on with it?  The location of image  is
> > processed in "def OnResult(self,event):" and is initialized in "def
> > __init__(self, parent, id):" of "class MainFrame" ( See the code
> > attached).
> >
> 	Off hand, it is doing just what the code says it should.
>
> 	Each time you update position, you are COPYING a SMALL rectangle
> (the "moved" image) into the larger frame... Only the pixels
> corresponding to the small rectangle are changed -- anything that was
> already in the frame stays there.
>
> 	You might want to double-buffer the operations...
>
> 	For each move:
> 		clear an unseen "frame-sized" buffer
> 		compute the new location of the "moved" image
> 		blit the "moved" image into the unseen buffer
> 		blit the full unseen buffer to the viewed frame (not to a
> portion of the frame, but replace the entire frame contents)
>
> 	The double-buffer is to avoid annoying the viewer with the "flash"
> of clearing out the view frame before drawing the new image
>
> --
> 	Wulfraed	Dennis Lee Bieber		KD6MOG
> 	wlfraed at ix.netcom.com		wulfraed at bestiaria.com
> 		HTTP://wlfraed.home.netcom.com/
> 	(Bestiaria Support Staff:		web-asst at bestiaria.com)
> 		HTTP://www.bestiaria.com/




More information about the Python-list mailing list