File tree 2 files changed +5
-15
lines changed
2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,7 @@ def resizeEvent(self, event):
334
334
hinch = h / dpival
335
335
self .figure .set_size_inches (winch , hinch )
336
336
FigureCanvasBase .resize_event (self )
337
- self .draw ()
338
- self .update ()
337
+ self .draw_idle ()
339
338
QtWidgets .QWidget .resizeEvent (self , event )
340
339
341
340
def sizeHint (self ):
@@ -417,17 +416,7 @@ def stop_event_loop(self):
417
416
stop_event_loop .__doc__ = FigureCanvasBase .stop_event_loop_default .__doc__
418
417
419
418
def draw_idle (self ):
420
- 'update drawing area only if idle'
421
- d = self ._idle
422
- self ._idle = False
423
-
424
- def idle_draw (* args ):
425
- try :
426
- self .draw ()
427
- finally :
428
- self ._idle = True
429
- if d :
430
- QtCore .QTimer .singleShot (0 , idle_draw )
419
+ self ._priv_update ()
431
420
432
421
433
422
class MainWindow (QtWidgets .QMainWindow ):
@@ -666,7 +655,7 @@ def zoom(self, *args):
666
655
self ._update_buttons_checked ()
667
656
668
657
def dynamic_update (self ):
669
- self .canvas .draw ()
658
+ self .canvas .draw_idle ()
670
659
671
660
def set_message (self , s ):
672
661
self .message .emit (s )
Original file line number Diff line number Diff line change @@ -63,14 +63,15 @@ class FigureCanvasQTAggBase(object):
63
63
64
64
def drawRectangle (self , rect ):
65
65
self ._drawRect = rect
66
- self .repaint ()
66
+ self .draw_idle ()
67
67
68
68
def paintEvent (self , e ):
69
69
"""
70
70
Copy the image from the Agg canvas to the qt.drawable.
71
71
In Qt, all drawing should be done inside of here when a widget is
72
72
shown onscreen.
73
73
"""
74
+ FigureCanvasAgg .draw (self )
74
75
75
76
# FigureCanvasQT.paintEvent(self, e)
76
77
if DEBUG :
You can’t perform that action at this time.
0 commit comments