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

Skip to content

Commit 3bd0f57

Browse files
committed
fix mutable default arguments
1 parent e53ba3e commit 3bd0f57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/user_interfaces/embedding_in_tk_canvas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from matplotlib.backends.backend_agg import FigureCanvasAgg
99

1010

11-
def draw_figure(canvas, figure, loc=[0, 0]):
11+
def draw_figure(canvas, figure, loc=(0, 0)):
1212
""" Draw a matplotlib figure onto a Tk canvas
1313
1414
loc: location of top-left corner of figure on canvas in pixels.
@@ -49,7 +49,7 @@ def draw_figure(canvas, figure, loc=[0, 0]):
4949

5050
# Keep this handle alive, or else figure will disappear
5151
fig_x, fig_y = 100, 100
52-
fig_photo = draw_figure(canvas, fig, loc=[fig_x, fig_y])
52+
fig_photo = draw_figure(canvas, fig, loc=(fig_x, fig_y))
5353
fig_w, fig_h = fig_photo.width(), fig_photo.height()
5454

5555
# Add more elements to the canvas, potentially on top of the figure

0 commit comments

Comments
 (0)