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

Skip to content

Commit a8fa7a9

Browse files
author
Federico Ariza
committed
fix bug in tkinter python3.6
1 parent baa5f8e commit a8fa7a9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,9 +913,16 @@ def _Button(self, text, image_file, toggle, frame):
913913
b = Tk.Button(master=frame, text=text, padx=2, pady=2, image=im,
914914
command=lambda: self._button_click(text))
915915
else:
916+
# There is a bug in tkinter included in some python 3.6 versions
917+
# that without this variable, produces a "visual" toggling of
918+
# other near checkbuttons
919+
# https://bugs.python.org/issue29402
920+
# https://bugs.python.org/issue25684
921+
var = Tk.IntVar()
916922
b = Tk.Checkbutton(master=frame, text=text, padx=2, pady=2,
917923
image=im, indicatoron=False,
918-
command=lambda: self._button_click(text))
924+
command=lambda: self._button_click(text),
925+
variable=var)
919926
b._ntimage = im
920927
b.pack(side=Tk.LEFT)
921928
return b

0 commit comments

Comments
 (0)