Since I couldn't think of a way to use wx.animate.AnimationCtrl to
render inside grid cells, i decided to render frame by frame using
wx.BitmapFromImage.
I extended Grid.PyGridCellRenderer class and tried to implement Draw
function, but i can't think of a good way to get timing right, here're
the issues, I'm not sure if my assumptions are right.
1) Draw is only called if there's a need to redraw the cell
(scrolling, another window get over it and then away, etc..)
2) For all cells with the renderer class there's only one instance of
the class which makes it hard to make timing
Is there a simple way to render gifs inside grid cells.
Since I couldn't think of a way to use wx.animate.AnimationCtrl to
render inside grid cells, i decided to render frame by frame using
wx.BitmapFromImage.
I extended Grid.PyGridCellRenderer class and tried to implement Draw
function, but i can't think of a good way to get timing right, here're
the issues, I'm not sure if my assumptions are right.
1) Draw is only called if there's a need to redraw the cell
(scrolling, another window get over it and then away, etc..)
You can trigger a paint event (which will then call Draw for the affected cells) by calling theGrid.GetGridWindow().Refresh or RefreshRect.
2) For all cells with the renderer class there's only one instance of
the class which makes it hard to make timing
You could give each cell its own instance of the animation renderer.
Also, on the timing issue the animation base class has a GetDelay method that gives you the number of milliseconds until the next animation frame should be displayed. That value can be used with a timer so you'll be notified at that time and can trigger the drawing of the new frame.