Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 55b69af

Browse filesBrowse files
committed
Fix ImportError: No module named 'Tkinter' on Python 3
1 parent f6fca8a commit 55b69af
Copy full SHA for 55b69af

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎examples/user_interfaces/embedding_in_tk_canvas.py

Copy file name to clipboardExpand all lines: examples/user_interfaces/embedding_in_tk_canvas.py
+5-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.