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

Skip to content

Commit bcfd4f5

Browse files
committed
DOC: tweak how initial draw and updates are handled
1 parent a7c4e9f commit bcfd4f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/event_handling/poly_editor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def draw_callback(self, event):
5959
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
6060
self.ax.draw_artist(self.poly)
6161
self.ax.draw_artist(self.line)
62-
self.canvas.blit(self.ax.bbox)
62+
# do not need to blit here, this will fire before the screen is
63+
# updated
6364

6465
def poly_changed(self, poly):
6566
'this method is called whenever the polygon object is called'
@@ -131,8 +132,8 @@ def key_press_callback(self, event):
131132
axis=0)
132133
self.line.set_data(zip(*self.poly.xy))
133134
break
134-
135-
self.canvas.draw()
135+
if self.line.stale:
136+
self.canvas.draw_idle()
136137

137138
def motion_notify_callback(self, event):
138139
'on mouse movement'

0 commit comments

Comments
 (0)