[wxPython-users] Bitmap in a wxScrolledWindow

Gavana, Andrea gavana at kpo.kz
Fri Jun 16 05:38:42 PDT 2006


Hello NG,

thank you Simon, the EVT_ERASE_BACKGROUND cured almost all the flicker (but not all). I have tried to implement Peter's suggestion in this way:

    def OnPaint(self, event):

        width = self.currentbmp.GetWidth()
        height = self.currentbmp.GetHeight()
        
        size = self.scrolled.GetSize()
        xmin = (size.x - width)/2
        ymin = (size.y - height)/2

        dc = wx.PaintDC(self.scrolled)

        self.PrepareDC(dc)
        dc.Clear()

        memdc = wx.MemoryDC()
        bmp = wx.EmptyBitmap(width, height)
        memdc.SelectObject(bmp)
        memdc.DrawBitmap(self.currentbmp, 0, 0)
        
        dc.Blit(xmin, ymin, width, height, memdc, 0, 0)

        memdc.SelectObject(wx.NullBitmap)        

        event.Skip()


But it seems to me that the reduction of the flicker is almost zero. It flickers as before :-D
Probably it is my poor knowledge of wx.DC things.
Or probably it is that the images are quite big (1.5 MB, 2000 pixels wide), and so I have to live with some of the flicker :-)

Mhm... Will double buffering help here?

Thanks for your comments...

Andrea.

_________________________________________
Andrea Gavana (gavana at kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
 
Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
 




More information about the wxpython-users mailing list