8000 Deprecate FigureCanvasTkAgg.show in favor of .draw. · matplotlib/matplotlib@f56e001 · GitHub
[go: up one dir, main page]

Skip to content

Commit f56e001

Browse files
committed
Deprecate FigureCanvasTkAgg.show in favor of .draw.
This provides the same method name as in the other backends.
1 parent 87fde92 commit f56e001

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

examples/user_interfaces/embedding_in_tk2_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def destroy(e):
3838

3939
# a tk.DrawingArea
4040
canvas = FigureCanvasTkAgg(f, master=root)
41-
canvas.show()
41+
canvas.draw()
4242
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
4343

4444
canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

examples/user_interfaces/embedding_in_tk_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
# a tk.DrawingArea
3737
canvas = FigureCanvasTkAgg(f, master=root)
38-
canvas.show()
38+
canvas.draw()
3939
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
4040

4141
toolbar = NavigationToolbar2TkAgg(canvas, root)

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def resize(self, event):
231231
master=self._tkcanvas, width=int(width), height=int(height))
232232
self._tkcanvas.create_image(int(width/2),int(height/2),image=self._tkphoto)
233233
self.resize_event()
234-
self.show()
234+
self.draw()
235235

236236
# a resizing will in general move the pointer position
237237
# relative to the canvas, so process it as a motion notify
@@ -307,10 +307,12 @@ def draw(self):
307307
self._master.update_idletasks()
308308

309309
def blit(self, bbox=None):
310-
tkagg.blit(self._tkphoto, self.renderer._renderer, bbox=bbox, colormode=2)
310+
tkagg.blit(
311+
self._tkphoto, self.renderer._renderer, bbox=bbox, colormode=2)
311312
self._master.update_idletasks()
312313

313-
show = draw
314+
show = cbook.deprecated("2.2", name="FigureCanvasTkAgg.show",
315+
alternative="FigureCanvasTkAgg.draw")(draw)
314316

315317
def draw_idle(self):
316318
'update drawing area only if idle'
@@ -738,8 +740,8 @@ def configure_subplots(self):
738740
window = Tk.Toplevel()
739741
canvas = FigureCanvasTkAgg(toolfig, master=window)
740742
toolfig.subplots_adjust(top=0.9)
741-
canvas.tool = SubplotTool(self.canvas.figure, toolfig)
742-
canvas.show()
743+
canvas.tool = SubplotTool(self.canvas.figure, toolfig)
744+
canvas.draw()
743745
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
744746
window.grab_set()
745747

@@ -1021,7 +1023,7 @@ def init_window(self):
10211023
canvas = FigureCanvasTkAgg(toolfig, master=self.window)
10221024
toolfig.subplots_adjust(top=0.9)
10231025
_tool = SubplotTool(self.figure, toolfig)
1024-
canvas.show()
1026+
canvas.draw()
10251027
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
10261028
self.window.protocol("WM_DELETE_WINDOW", self.destroy)
10271029

0 commit comments

Comments
 (0)
0