Fix Python – matplotlib error – no module named tkinter

I tried to use the matplotlib package via Pycharm IDE on windows 10.
when I run this code:
from matplotlib import pyplot

I get the following error:
ImportError: No module named ‘tkinter’

I know that in python 2.x it was called Tkinter, but that is not the problem – I just installed a brand new python 3.5.1.
EDIT: in addition, I also tried to imp….

Fix Python – _tkinter.TclError: no display name and no $DISPLAY environment variable

I am running a simple python script in the server:
import matplotlib.pyplot as plt
import numpy as np

x = np.random.randn(60)
y = np.random.randn(60)

plt.scatter(x, y, s=20)

out_png = ‘path/to/store/out_file.png’
plt.savefig(out_png, dpi=150)

I try to use the command python example.py in this server which has matplotlib 1.5.1 installed it fail….

Fix Python – How to pass arguments to a Button command in Tkinter?

Suppose I have the following Button made with Tkinter in Python:
import Tkinter as Tk
win = Tk.Toplevel()
frame = Tk.Frame(master=win).grid(row=1, column=1)
button = Tk.Button(master=frame, text=’press’, command=action)

The method action is called when I press the button, but what if I wanted to pass some arguments to the method action?
I have tr….

Fix Python – Install tkinter for Python

I am trying to import Tkinter. However, I get an error stating that Tkinter has not been installed:
ImportError: No module named _tkinter, please install the python-tk package

I could probably install it using synaptic manager (can I?), however, I would have to install it on every machine I program on. Would it be possible to add the Tkinter libr….

Fix Python – ImportError: No module named ‘Tkinter’

For some reason, I can’t use the Tkinter or tkinter module.
After running the following command in the python shell
import Tkinter

or
import tkinter

I got this error

ModuleNotFoundError: No module named ‘Tkinter’

or

ModuleNotFoundError: No module named ‘tkinter’

What could be the reason for and how can we solve it?
….