Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1de6c6f

Browse files
committed
fixed gtk anim bug
svn path=/trunk/matplotlib/; revision=1587
1 parent eaee1cf commit 1de6c6f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

lib/matplotlib/backends/backend_gtk.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import division
22

3-
import os
4-
import sys
3+
import os, sys
54
def fn_name(): return sys._getframe(1).f_code.co_name
65

76
import gobject
@@ -217,7 +216,7 @@ def configure_event(self, widget, event):
217216

218217
self._need_redraw = True
219218
return False # finish event propagation?
220-
219+
221220

222221
def draw(self):
223222
# synchronous window redraw (like GTK+ 1.2 used to do)
@@ -231,13 +230,16 @@ def draw(self):
231230

232231
# synchronous draw (needed for animation)
233232
x, y, w, h = self.allocation
233+
#print x, y, w, h
234234
self._pixmap_prepare (w, h)
235235
self._render_figure(self._pixmap, w, h)
236236
self._need_redraw = False
237237
self.window.draw_drawable (self.style.fg_gc[self.state],
238-
self._pixmap, x, y, x, y, w, h)
238+
self._pixmap, 0, 0, 0, 0, w, h)
239239

240240

241+
242+
241243
def draw_idle(self):
242244
def idle_draw(*args):
243245
self.draw()
@@ -277,6 +279,12 @@ def _pixmap_prepare(self, width, height):
277279
height)
278280
create_pixmap = True
279281

282+
283+
if height > self._pixmap_height:
284+
self._pixmap_height = max (int (self._pixmap_height * 1.1),
285+
height)
286+
287+
280288
if create_pixmap:
281289
if _debug: print 'FigureCanvasGTK.%s new pixmap' % fn_name()
282290
self._pixmap = gdk.Pixmap (self.window, self._pixmap_width,

0 commit comments

Comments
 (0)