Skip to content

Commit 5e59222

Browse files
committed
Merge pull request #5790 from cgohlke/patch-2
Fix ImportError: No module named 'Tkinter' on Python 3
1 parent 9d76fd4 commit 5e59222

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/user_interfaces/embedding_in_tk_canvas.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
import matplotlib as mpl
55
import numpy as np
6-
import Tkinter as tk
6+
import sys
7+
if sys.version_info[0] < 3:
8+
import Tkinter as tk
9+
else:
10+
import tkinter as tk
711
import matplotlib.backends.tkagg as tkagg
812
from matplotlib.backends.backend_agg import FigureCanvasAgg
913

0 commit comments

Comments
 (0)