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

Skip to content

Commit 3783416

Browse files
committed
Pass ints rather than floats to Tkinter when it expects it. Failure to do so causes exceptions on locales with a non-'.' as a decimal separator. Reported by Hans Bering.
1 parent d9ca8ba commit 3783416

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ def resize(self, event):
240240

241241
self._tkcanvas.delete(self._tkphoto)
242242
self._tkphoto = Tk.PhotoImage(
243-
master=self._tkcanvas, width=width, height=height)
244-
self._tkcanvas.create_image(width/2,height/2,image=self._tkphoto)
243+
master=self._tkcanvas, width=int(width), height=int(height))
244+
self._tkcanvas.create_image(int(width/2),int(height/2),image=self._tkphoto)
245245
self.resize_event()
246246
self.show()
247247

@@ -555,7 +555,7 @@ def __init__(self, canvas, window):
555555
xmin, xmax = canvas.figure.bbox.intervalx
556556
height, width = 50, xmax-xmin
557557
Tk.Frame.__init__(self, master=self.window,
558-
width=width, height=height,
558+
width=int(width), height=int(height),
559559
borderwidth=2)
560560

561561
self.update() # Make axes menu
@@ -711,7 +711,7 @@ def _init_toolbar(self):
711711
xmin, xmax = self.canvas.figure.bbox.intervalx
712712
height, width = 50, xmax-xmin
713713
Tk.Frame.__init__(self, master=self.window,
714-
width=width, height=height,
714+
width=int(width), height=int(height),
715715
borderwidth=2)
716716

717717
self.update() # Make axes menu

0 commit comments

Comments
 (0)