Problem with wx.StaticBitmap

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • torsak
    New Member
    • Mar 2008
    • 1

    Problem with wx.StaticBitmap

    Hello everyone,

    I'd like to display an animation in a frame. Each frame is calculated in real time, so it does not consist in display a GIF animation.
    I am using a wx.StaticBitmap , and I replace the bitmap inside every 50 ms.
    However each time the bitmap is changed, the grey frame background is displayed, so the animation is sparkling. In Tkinter the animation is displaying properly if i use a Canvas.

    here is the main part of my code:

    Code:
    class MyFrame(wx.Frame):
            
            def __init__(self):
    			wx.Frame.__init__(self, None, -1, '', pos = (-1, -1), style = (wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP), size=(300, 200))
    			
    			self.bmp = wx.StaticBitmap(parent = self, bitmap=wx.EmptyImage(WIDTH, HEIGHT).ConvertToBitmap())
    
    			self.Show()
    			thread.start_new_thread( self.refresh, () )
    				
    				
            def refresh(self):
    			while True:
    				self.bmp.SetBitmap( image() )  #THE image FUNCTION RETURNS A BITMAP
    				time.sleep(0.05)

    Thanks in advance for your answers.
  • chaosAD
    New Member
    • Feb 2008
    • 9

    #2
    You'll proberly want to use the gdi for animation http://wiki.wxpython.org/DoubleBufferedDrawing

    Comment

    Working...